emoxam
(Emoxam)
January 15, 2024, 9:33am
1
i receive the spring app logs and i want to parse time from logs to @timestamp
that's what i got but timestamp is not the same.
input {
tcp {
port => 5000
codec =>plain
}
}
filter {
if [message] =~ /actions/ {
grok {
match => [ "message",
"%{GREEDYDATA:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:data}"
]
}
date {
match => [ "timestamp" , "yyyy-MM-dd HH:mm:ss.SSS" ]
}
}
}
What am i doing wrong ?
Rios
(Rios)
January 15, 2024, 9:44am
2
Can you show us how does a full message look like?
emoxam
(Emoxam)
January 16, 2024, 12:49pm
3
Sorry i forgot the main string
target => "@timestamp "
P.S. To be clear tha part of config should be
date {
match => [ "timestamp" , "yyyy-MM-dd HH:mm:ss,SSS" ]
target => "@timestamp "
}
leandrojmp
(Leandro Pereira)
January 16, 2024, 12:55pm
4
You need to share how your source message looks like, there is nothing wrong in the date
filter, you also does not need to specify the target if the target is the @timestamp
field, this is the default.
If your date filter is not work, so something is wrong with the value of your timestamp
field, which could indicate something wrong with your parsing.
You need to share a sample of a message that you are receiving and trying to parse.
2 Likes
leandrojmp
(Leandro Pereira)
January 16, 2024, 6:41pm
6
emoxam:
2024-01-16 20:45:31.293
The timestamp in your log has the format yyyy-MM-dd HH:mm:ss.SSS
, but in your date
filter you have yyyy-MM-dd HH:mm:ss,SSS
.
The separator between seconds and miliseconds is not correct in your date
filter.
1 Like
emoxam
(Emoxam)
January 16, 2024, 6:54pm
7
You are right! Thank! My fault!
The right part is
date {
match => [ "timestamp" , "yyyy-MM-dd HH:mm:ss.SSS" ]
target => "@timestamp "
}
emoxam
(Emoxam)
January 17, 2024, 6:46am
8
I wanted to show that string
target => "@timestamp "
is commented, but # makes it bigger))
emoxam
(Emoxam)
January 17, 2024, 8:01am
9
From the kubernetes pod console i se there is
.
But at the
journalctl -o cat -xefu logstash.service
i see there is
,
why is it so ?
leandrojmp
(Leandro Pereira)
January 17, 2024, 12:10pm
10
This will show the logs from your logstash service, it is unrelated to the logs of your application that you are parsing.
The timestamp in logstash logs uses ,
between the seconds and miliseconds.
1 Like
system
(system)
Closed
February 14, 2024, 12:10pm
11
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.