Discussion:
[rsyslog] Rotating logs every N minutes (rsyslog-latest)
RB via rsyslog
2018-05-24 17:03:58 UTC
Permalink
I'm probably missing something obvious, but am struggling coming up
with a reasonable solution to rotate files every N minutes.

I see that rsyslog has half- and quarter- hour properties, and I can
fake 10-minute intervals with "%$MINUTE.1.1%0", but if, say, I want to
break them over every 5 minutes, or every 12, there doesn't seem to be
an obvious solution.

For my particular application, log rotation in the single-digit minute
range would be ideal, but more than 1 minute while less than 10. Is
this just silly?
_______________________________________________
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.
David Lang
2018-05-24 18:00:01 UTC
Permalink
you can create your own variable to use in a template, you can do math on this
variable something like int(min/5)

David Lang
_______________________________________________
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.
RB via rsyslog
2018-05-24 18:34:20 UTC
Permalink
Post by David Lang
you can create your own variable to use in a template, you can do math on
this variable something like int(min/5)
Thanks, I'd started in that direction, but the examples in the
documentation were sufficiently esoteric that I lost my way. It's also
not very clear how you interpolate variables into templates. For
example, this didn't work as I hoped it would:

set $.mindiv = ($$minute / 5);
template(name="foo" type="string" string="/var/log/split-%$.mindiv%")

That just produced a file named "/var/log/split-"
_______________________________________________
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.
Loading...