A.Klos
January 31, 2023, 10:00am
1
Hi,
I have still problem to get right timestamp in elastic.
One Row of log looks like:
20210611 111146 SOME Date Field ...
I tried:
grok {
match => [ "message" , "%{DATA:timestamp}" ]
}
date {
match => [ "timestamp","yyyyMMdd HHmmss" ]
timezone => [ "Europe/Berlin" ]
target => "@timestamp"
}
}
Still no chance to get right date format into timestamp
any ideas?
Regards
Axel
Rios
(Rios)
January 31, 2023, 1:33pm
2
Try custom date format, similar to DATESTAMP_EVENTLOG
grok {
match => { "message" => [ "%{DATELOG:timestamp} %{GREEDYDATA}"] }
pattern_definitions => { "DATELOG" => "%{YEAR}%{MONTHNUM2}%{MONTHDAY} %{HOUR}%{MINUTE}%{SECOND}}" }
}
2 Likes
A.Klos
February 3, 2023, 1:45pm
3
thank you .. unfortunately doesn't working.
filter {
if "fb-uc4" in [tags] {
grok {
match => { "message" => [ "%{DATELOG:timestamp} %{GREEDYDATA}"] }
pattern_definitions => { "DATELOG" => "%{YEAR}%{MONTHNUM2}%{MONTHDAY} %{HOUR}%{MINUTE}%{SECOND}}" }
}
}
}
I receive grok parse failure
REgards
Axel
Rios
(Rios)
February 3, 2023, 2:08pm
4
True, my appology, extra } after SECOND. You don't need %{GREEDYDATA}, it's optional.
grok {
match => { "message" => [ "%{DATELOG:timestamp} "] }
pattern_definitions => { "DATELOG" => "%{YEAR}%{MONTHNUM2}%{MONTHDAY} %{HOUR}%{MINUTE}%{SECOND}" }
}
date {
match => ["timestamp", "YYYYMMdd HHmmss"]
timezone => "Europe/Berlin"
target => "timestamp"
}
Result:
{
"@timestamp" => 2023-02-03T14:07:38.710260900Z,
"message" => "20210611 111146 SOME Date Field",
"timestamp" => 2021-06-11T09:11:46.000Z
}
system
(system)
Closed
March 3, 2023, 2:08pm
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.