[syslog-ng] [PATCH] basicfuncs: Implement a $(now) template function.
Gergely Nagy
algernon at balabit.hu
Sat Aug 20 14:38:31 CEST 2011
Balazs Scheidler <bazsi at balabit.hu> writes:
> Hmm.. the syslog-ng team in BalaBit have invented a SYSUPTIME macro to
> use in their SNMP destination (in PE 4.1), see their git tree on
> git.balabit.hu
>
> Maybe it'd be better to create SYSNOW for consistency.
>
> Hmm again, but SYSUPTIME returns the current time in hundreds of a
> second (as needed by SNMP), and the implementation is slow
> (reads /proc/uptime at every invocation).
>
> Also, it'd be nice to apply frac_digits() to both values.
>
> Hmmm the 3rd time. I'm not sure how to go forwards. I'm Ccing Robi (the
> documentation guy) if he has an opinion.
>
> Any good ideas how to resolve the inconsistencies?
A SYSNOW macro sounds good to me. For consistency's sake, it could even
return the current time in hundreths of seconds, like SYSUPTIME.
For my use case, the speed of it is not a concern, so I don't mind it
being slow. However, depending on how often cached_time (or however it
was called) is updated, it might be an option to reuse that. Then we
don't need to query the system time at every macro expansion. Just once
per poll cycle, if I remember correctly.
--
|8]
More information about the syslog-ng
mailing list