[openstack-dev] [oslo.log] RFC5424-compliant dates
Clark Boylan
cboylan at sapwetik.org
Fri Dec 11 18:52:12 UTC 2015
On Fri, Dec 11, 2015, at 10:12 AM, Chris St. Pierre wrote:
> RFC5424 requires timestamps in a strict subset of RFC3339. Currently,
> oslo.log has no way to provide dates in this format without specifying a
> custom logging formatter, which means that oslo.log is incapable of
> providing RFC5424-compliant log messages.
>
> I've proposed a proof-of-concept to add that capability, in the form of a
> new %(rfc3339time)s variable that can be used in log formats, at
> https://review.openstack.org/#/c/256584/. This is obviously still in the
> proof-of-concept phase, but I was hoping to get some comments on it to
> see
> if people think this is a sane and reasonable approach before I go any
> further.
This seems reasonable. strict_rfc3339 doesn't support leap seconds and
RFC5424 requires that they not be used so that is good as long as
strict_rfc3339 doesn't start supporting them magically by default in the
future. My only concern with this approach is that it appears to format
a timestamp in rfc3339 format for every log message even if that
attribute is unused in the log message. Not familiar enough with python
logging internals to suggest a better approach though.
>
> The other approach that makes sense to me would be to add a magic option
> to
> the log_date_format option (e.g., log_date_format = rfc3339 or
> log_date_format= rfc5424) that made %(asctime)s into an RFC3339
> timestamp.
I would avoid doing this beacuse asctime has a specific meaning in
python loggers. Will help reduce confusion if the underlying logging
system continues to work as expected.
Clark
More information about the OpenStack-dev
mailing list