logstash 解剖问题
Issue with logstash Dissect
我在剖析 ELK 堆栈中的以下文本 blob 时遇到了一些严重的问题
这是字段-
INFO [2019-06-20 10:37:42,734]
com.something.something.something.information.core.LoggingPiracyReporter:
Informational request: ip_address="1.1.1.1" domain_name="domain.com"
some_random_id="HrmwldM4DQNXoQF3AnYosJ0Mtig="
random_id_2="Isl/eC4ERnoLVEBMXYtWeMjwqkSKA2MPSsDnGHe4EzE=" number=1000
timestamp=1561027064 valid_token_present=true everything_ok=true
[Http/1.1] [8.8.8.8, 8.8.8.8, 8.8.8.8]
我目前有以下 -
dissect { mapping => { "message" => '%{} ip_address="%{ip}" domain_name="%
{name}" some_random_id="%{some_random_id}" random_id_2="%{random_id_2}"
number="%{number}"%{}' } }
它似乎在数字字段上中断,如果我删除数字它一切正常。(虽然会发出警告,但工作正常并在我的 kibana 中显示字段)
任何人都可以建议一种获取 IP address/Domain some_random_id/random_id_2 以及 [http/1.1] 块的方法。
映射中 %{number}
周围的引号没有出现在您提供的日志中,这会破坏您的过滤器。
使用此配置:
dissect {
mapping => {
"message" => '%{} ip_address="%{ip}" domain_name="%{name}" some_random_id="%{some_random_id}" random_id_2="%{random_id_2}" number=%{number} timestamp=%{timestamp} valid_token_present=%{valid} everything_ok=%{ok} [%{http}]'
}
}
我得到这个结果:
{
"ok": "true",
"random_id_2": "Isl/eC4ERnoLVEBMXYtWeMjwqkSKA2MPSsDnGHe4EzE=",
"message": "INFO [2019-06-20 10:37:42,734] com.something.something.something.information.core.LoggingPiracyReporter: Informational request: ip_address=\"1.1.1.1\" domain_name=\"domain.com\" some_random_id=\"HrmwldM4DQNXoQF3AnYosJ0Mtig=\" random_id_2=\"Isl/eC4ERnoLVEBMXYtWeMjwqkSKA2MPSsDnGHe4EzE=\" number=1000 timestamp=1561027064 valid_token_present=true everything_ok=true [Http/1.1] [8.8.8.8, 8.8.8.8, 8.8.8.8]\r",
"ip": "1.1.1.1",
"http": "Http/1.1",
"name": "domain.com",
"valid": "true",
"some_random_id": "HrmwldM4DQNXoQF3AnYosJ0Mtig=",
"timestamp": "1561027064",
"number": "1000"
}
我在剖析 ELK 堆栈中的以下文本 blob 时遇到了一些严重的问题
这是字段-
INFO [2019-06-20 10:37:42,734]
com.something.something.something.information.core.LoggingPiracyReporter:
Informational request: ip_address="1.1.1.1" domain_name="domain.com"
some_random_id="HrmwldM4DQNXoQF3AnYosJ0Mtig="
random_id_2="Isl/eC4ERnoLVEBMXYtWeMjwqkSKA2MPSsDnGHe4EzE=" number=1000
timestamp=1561027064 valid_token_present=true everything_ok=true
[Http/1.1] [8.8.8.8, 8.8.8.8, 8.8.8.8]
我目前有以下 -
dissect { mapping => { "message" => '%{} ip_address="%{ip}" domain_name="%
{name}" some_random_id="%{some_random_id}" random_id_2="%{random_id_2}"
number="%{number}"%{}' } }
它似乎在数字字段上中断,如果我删除数字它一切正常。(虽然会发出警告,但工作正常并在我的 kibana 中显示字段)
任何人都可以建议一种获取 IP address/Domain some_random_id/random_id_2 以及 [http/1.1] 块的方法。
映射中 %{number}
周围的引号没有出现在您提供的日志中,这会破坏您的过滤器。
使用此配置:
dissect {
mapping => {
"message" => '%{} ip_address="%{ip}" domain_name="%{name}" some_random_id="%{some_random_id}" random_id_2="%{random_id_2}" number=%{number} timestamp=%{timestamp} valid_token_present=%{valid} everything_ok=%{ok} [%{http}]'
}
}
我得到这个结果:
{
"ok": "true",
"random_id_2": "Isl/eC4ERnoLVEBMXYtWeMjwqkSKA2MPSsDnGHe4EzE=",
"message": "INFO [2019-06-20 10:37:42,734] com.something.something.something.information.core.LoggingPiracyReporter: Informational request: ip_address=\"1.1.1.1\" domain_name=\"domain.com\" some_random_id=\"HrmwldM4DQNXoQF3AnYosJ0Mtig=\" random_id_2=\"Isl/eC4ERnoLVEBMXYtWeMjwqkSKA2MPSsDnGHe4EzE=\" number=1000 timestamp=1561027064 valid_token_present=true everything_ok=true [Http/1.1] [8.8.8.8, 8.8.8.8, 8.8.8.8]\r",
"ip": "1.1.1.1",
"http": "Http/1.1",
"name": "domain.com",
"valid": "true",
"some_random_id": "HrmwldM4DQNXoQF3AnYosJ0Mtig=",
"timestamp": "1561027064",
"number": "1000"
}