I am trying to decode apache error logs using lua script. I was able to
extract the fileds i needed but having problem with time conversion.

my log timestamp is in the following format : [Sat Mar 14 23:42:45.990158
2015]

in my lua script, i am converting timestamp as follows:

local timestamp = l.P"[" * l.Cg(dt.build_strftime_grammar("%a %b %d
%H:%M:%S.%s %Y") / dt.time_to_ns, "timestamp") * "]"

and passing this timestamp filed to msg.Timestamp as follows:

if fields.timestamp then
msg.Timestamp = fields.timestamp
fields.timestamp = nil
end

But i am seeing the output as follows.
2015/03/14 23:42:47
:Timestamp: 1970-01-12 19:02:38 +0000 UTC

Please let me know me how to convert the timestamp to actual timestamp of
log entry.
_______________________________________________
Heka mailing list
Heka@mozilla.org
https://mail.mozilla.org/listinfo/heka

Reply via email to