Mailing List Archive

Casting Time Values
Hello List:

A quick question about casting time values.

set $.my_tstamp = $timereceived;

This results in $.my_tstamp being in format "Feb 12 13:52:35" when the
property value is output in a template.

This remains true even if dateFormat="rfc3339" is specified for the
field in the template.  property(name="$.my_tstamp" dateFormat="rfc3339")

Question: What can I do to have the result of the set statement be in
the RFC3339 time format "2020-02-12T13:52:35.391-06:00"?

Thanks in advance!

Regards,

_______________________________________________
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.
Re: Casting Time Values [ In reply to ]
I have amended my original message below to show the correct
$timereported value (not $timereceived which doesn't exist).

The same format issue remains if $timegenerated is used.

I also found and tried the format_time function...

set $.my_tstamp = format_time($timereported, "date-rfc3339");

...but again $.my_tstamp always comes out looking like "Feb 12 13:52:35".

We are currently at rsyslog v8.1910.

Thanks again for any help in getting the cast to produce an rfc3339 format!



On 2/12/20 8:57 AM, John Chivian via rsyslog wrote:
> Hello List:
>
> A quick question about casting time values.
>
> set $.my_tstamp = $timereported;
>
> This results in $.my_tstamp being in format "Feb 12 13:52:35" when the
> property value is output in a template.
>
> This remains true even if dateFormat="rfc3339" is specified for the
> field in the template.  property(name="$.my_tstamp" dateFormat="rfc3339")
>
> Question: What can I do to have the result of the set statement be in
> the RFC3339 time format "2020-02-12T13:52:35.391-06:00"?
>
> Thanks in advance!
>
> Regards,
>
> _______________________________________________
> 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.


_______________________________________________
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.