Ah, so would end up with something like the following… I assume...

#-----
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")
       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 = cnum($timestamp) * 1000;
        }
        set $.Timestamp = format_time(cnum($!Timestamp)/1000,"date-rfc3339")

        action(type="omfile"
               file="/var/log/remote/api-proxy.log" template="apiall")
        stop
}

> On 11 Oct 2017, at 8:39 pm, David Lang <[email protected]> wrote:
> 
> see github ticket #1814 it is adding a format_time() function that takes a 
> Unix timestamp and converts it to a date string. you would have to convert 
> from milliseconds to seconds (with a decimal portion) to use it, but it 
> sounds like exactly what you need.

_______________________________________________
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