In the above figure, I import a past log information, and the timestamp cannot be changed to the past.
nginx timestamp ”08/Apr/2018:14:39:07 +0800” unable to convert “2018-04-08T14:39:07Z”
I use the pipeline but I can’t always convert success.
pipeline rules:
rule “parse event timestamp”
when
true
then
let new_date = to_date(to_string($message.event_ts), “yyyy-MM-dd’T’HH:mm:ss Z”);
set_field(“event”, new_date);
end
Because I let the nginx log format was introduced into graylog json format, so after using json format resolution timestamp field is a string is not a time format, which is not directly use in time format.
It is only necessary to change the timestamp in the log to the time format.
I am using pipeline in graylog.
The pipeline rules are as follows:
rule "parse timestamp"
when
true
then
let ngx_timestamp=grok("%{HTTPDATE:timestamp;date;dd/MMM/yyyy:HH:mm:ss Z}", to_string($message.timestamp), true); //use grok rule
set_fields(ngx_timestamp);
end