Hi,

I’m trying to work out how to utilise an extracted timestamp from a JSON 
formatted log message as the time stamp to write to the log file? The timestamp 
in a string of an integer of milliseconds from EPOC.

Is there a way to interpret that number as a date time value?

Regards,

Marc

#-----
module(load="imtcp")
input(type="imtcp" address="127.0.0.1" port="601" ruleset="edge")

$MaxMessageSize 64k

template(name="apiall" type="list") {
# aws log agent requires a timestamp at the start of the log line
       property(name="$.Timestamp" dateFormat="rfc3339")
       constant(value=" ")
       property(name="$!all-json")
       constant(value="\n")
}

ruleset(name="edge") {
        action(type="mmjsonparse" cookie="")
        if $parsesuccess != "OK" then {
# capture malformed log message.
                reset $! = "";
                reset $!rawmsg = $jsonmesg!rawmsg;
                set $!Timestamp = $timestamp;
        }
        set $.Timestamp = cnum($!Timestamp);

        action(type="omfile"
               file="/var/log/remote/api-proxy.log" template="apiall")
        stop
}
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to