I would suggest to output $.ms as well. Also, simplify the new_unix
timeplate to just contain the default timestamp, see if it works and
than go from there with more complex processing.

all in all, it doesn't look wrong - probably a detail.

HTH
Rainer

El jue, 12 may 2022 a las 9:28, Johan Ryberg via rsyslog
(<[email protected]>) escribió:
>
> Hi,
>
> Running latest version of rsyslog (8.2204.1)
>
> I'm trying to create a template that ensures unixtimestamp with
> milliseconds.
>
> This is as far as I got
>
> template(name="ms" type="string"
> string="%timereported:1:3:date-subseconds%")
> set $!ms = exec_template("ms");
> if ($.ms == "0") then {
>      set $.ms = "000";
> }
> template(name="new_unix" type="string"
> string="%timereported:::date-unixtimestamp%%$.ms%")
> set $!new_unix = exec_template("new_unix");
>
> template(name="storage" type="list" option.jsonf="on") {
>      property(outname="timestamp" name="timereported" dateFormat="rfc3339"
> format="jsonf")
>      property(outname="unixtime" name="$!new_unix" format="jsonf")
>      property(outname="host" name="fromhost-ip" format="jsonf")
>      property(outname="message" name="rawmsg-after-pri" format="jsonf")
>      property(outname="log_id" name="uuid" format="jsonf")
> }
>
> Sadly the output of unixtime is always empty, "unixtime": ""
>
> I would very much appreciate some guidance how to make it work and if
> possible, more efficient
>
> Best regards Johan Ryberg
> _______________________________________________
> rsyslog mailing list
> https://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.
_______________________________________________
rsyslog mailing list
https://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