emoxam
(Emoxam)
January 26, 2024, 7:56am
1
Part of a config
filter {
if [message] =~ /actions/ or [message] =~ /172\.16\.10\.78/ or [message] =~ /172\.16\.10\.77/ {
grok {
match => [ "message",
"%{GREEDYDATA:timestamp}%{LOGLEVEL:level}%{GREEDYDATA:data}"
]
}
log string
2024-01-26 10:38:40.503 DEBUG [actions,,] 7 --- [/api/v2/spans}}] o.s.w.HttpLogging : HTTP POST http://172.16.10.78:9411/api/v2/spans
And here how it looks like at kibana
Why _grokparsefailure ?
Rios
(Rios)
January 26, 2024, 8:46am
2
You are missing spaces.
Grok should be something like this:
%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} \[%{DATA:something1},%{DATA:something2},%{DATA:something3}\] %{POSINT:mum} %{DATA:something4} \[%{DATA:something5}\] %{DATA:method} : %{DATA:protocol} %{DATA:httpmethod} %{URI:url}$
Also you can use %(SPACE) or \s+ instead of space " "
emoxam
(Emoxam)
January 26, 2024, 9:30am
3
Can i use
"%{GREEDYDATA:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:data}"
?
Rios
(Rios)
January 26, 2024, 10:23am
4
Yes, nobody forbids you, however you will get:
timestamp: 2024-01-26·10:38:40.503
level: DEBU
data: [actions,,]·7·---·[/api/v2/spans}}]·o.s.w.HttpLogging·:·HTTP·POST·http://172.16.10.78:9411/api/v2/spans
emoxam
(Emoxam)
January 26, 2024, 12:02pm
5
According to ELK grok pattern i got
{
"data": "[actions,,] 7 --- [/api/v2/spans}}] o.s.w.HttpLogging : HTTP POST http://172.16.10.78:9411/api/v2/spans",
"level": "DEBUG",
"timestamp": "2024-01-26 10:38:40.503"
}
Rios
(Rios)
January 26, 2024, 12:38pm
6
Exactly what I wrote above.
system
(system)
Closed
February 23, 2024, 12:38pm
7
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.