← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~harlowja/cloud-init:just-file-logs into cloud-init:master

 

I'd like to see this merged.

Currently we see mixed timestamp formats in cloud-init.log:

2016-08-29 15:12:15,475 - __init__.py[DEBUG]: handling ssh with freq=None and args=[]
Aug 29 15:12:15 p1 [CLOUDINIT] cloud-init-cfg[INFO]: cloud-init-cfg ['all', 'config']

The point in which the logging format changes depending on whether (and when) the syslog service becomes available and cloud-init updates the logging configuration.

Besides the mixed format, the default rsyslog format (On Ubuntu at least) doesn't include a sub-second timestamp by default, where as the logging module default %(asctime) does at least provide millisecond resolution (note the ,475 in the %(asctime) and the lack of subsecond resolution in the second entry from above).

I'd also like to see a change to the default formatting string to include the same [CLOUDINIT] string, which is injected in the syslog based formatting. 

Keeping these strings consistent makes parsing cloud-init.log more reliable.

Please consider adding this to your MP, or conversely, I can propose this separately after
this MP is merged.

root@x1:/etc/cloud/cloud.cfg.d# diff -u 05_logging.cfg.dist 05_logging.cfg
--- 05_logging.cfg.dist	2016-07-14 18:49:20.000000000 +0000
+++ 05_logging.cfg	2016-09-15 21:51:12.592673811 +0000
@@ -35,7 +35,7 @@
    args=(sys.stderr,)
    
    [formatter_arg0Formatter]
-   format=%(asctime)s - %(filename)s[%(levelname)s]: %(message)s
+   format=%(asctime)s [CLOUDINIT] %(filename)s[%(levelname)s]: %(message)s

-- 
https://code.launchpad.net/~harlowja/cloud-init/+git/cloud-init/+merge/301729
Your team cloud init development team is requested to review the proposed merge of ~harlowja/cloud-init:just-file-logs into cloud-init:master.


References