I'm trying to handle an nginx access log in logstash.
In order to get millisecond accuracy for my timestamps, I'm using the $msec
variable. This means that timestamps will be of the form 1430832725.814
, where the integer part is a UNIX timestamp, and the fraction part is in milliseconds. Unfortunately, I can't find a logstash date format which can parse UNIX timestamps.
Is there another way to get nginx to log with millisecond accuracy? Or a way to get the logstash date filter to parse UNIX timestamps?
The
UNIX
format literal can handle fractional seconds, so it will be able to parse an$msec
field.firstly, using grok filter to map the $msec field to a output field
then using another Date filter to convert it to @timestamp field
If you want to map to fields other than @timestamp, refer to Logstash reference