From a40b065bd33276a3cbcdb0964220680897a236ed Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Fri, 24 Jun 2016 15:46:58 -0400 Subject: [PATCH] syslog: fix timestamp (#1579) Previously the timestamp was locked to the time at which the logger process started. This change parses messages in bash and then calls the logger once for each message ignoring newlines (read -r) in order to guarantee the timestamp is correct. --- conf/init/service/buildlogsarchiver/log/run | 4 +++- conf/init/service/buildmanager/log/run | 4 +++- conf/init/service/gcworker/log/run | 4 +++- conf/init/service/gunicorn_registry/log/run | 4 +++- conf/init/service/gunicorn_secscan/log/run | 4 +++- conf/init/service/gunicorn_verbs/log/run | 4 +++- conf/init/service/gunicorn_web/log/run | 4 +++- conf/init/service/jwtproxy/log/run | 4 +++- conf/init/service/logrotateworker/log/run | 4 +++- conf/init/service/nginx/log/run | 4 +++- conf/init/service/notificationworker/log/run | 4 +++- conf/init/service/queuecleanupworker/log/run | 4 +++- conf/init/service/repositoryactioncounter/log/run | 4 +++- conf/init/service/security_notification_worker/log/run | 4 +++- conf/init/service/securityworker/log/run | 4 +++- conf/init/service/service_key_worker/log/run | 4 +++- conf/init/service/storagereplication/log/run | 4 +++- 17 files changed, 51 insertions(+), 17 deletions(-) diff --git a/conf/init/service/buildlogsarchiver/log/run b/conf/init/service/buildlogsarchiver/log/run index d9f721216..b1fd324e3 100755 --- a/conf/init/service/buildlogsarchiver/log/run +++ b/conf/init/service/buildlogsarchiver/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t buildlogsarchiver +while read -r msg; do + logger -i -t buildlogsarchiver "$msg" +done diff --git a/conf/init/service/buildmanager/log/run b/conf/init/service/buildmanager/log/run index c20c3756a..336d47107 100755 --- a/conf/init/service/buildmanager/log/run +++ b/conf/init/service/buildmanager/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t buildmanager +while read -r msg; do + logger -i -t buildmanager "$msg" +done diff --git a/conf/init/service/gcworker/log/run b/conf/init/service/gcworker/log/run index 7c1ee8e2f..4b362f781 100755 --- a/conf/init/service/gcworker/log/run +++ b/conf/init/service/gcworker/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t gcworker +while read -r msg; do + logger -i -t gcworker "$msg" +done diff --git a/conf/init/service/gunicorn_registry/log/run b/conf/init/service/gunicorn_registry/log/run index 97ff2b3b2..d38a1b127 100755 --- a/conf/init/service/gunicorn_registry/log/run +++ b/conf/init/service/gunicorn_registry/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t gunicorn_registry +while read -r msg; do + logger -i -t gunicorn_registry "$msg" +done diff --git a/conf/init/service/gunicorn_secscan/log/run b/conf/init/service/gunicorn_secscan/log/run index a8ced867a..2898667ea 100755 --- a/conf/init/service/gunicorn_secscan/log/run +++ b/conf/init/service/gunicorn_secscan/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t gunicorn_secscan +while read -r msg; do + logger -i -t gunicorn_secscan "$msg" +done diff --git a/conf/init/service/gunicorn_verbs/log/run b/conf/init/service/gunicorn_verbs/log/run index 2bf346adc..e256276c6 100755 --- a/conf/init/service/gunicorn_verbs/log/run +++ b/conf/init/service/gunicorn_verbs/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t gunicorn_verbs +while read -r msg; do + logger -i -t gunicorn_verbs "$msg" +done diff --git a/conf/init/service/gunicorn_web/log/run b/conf/init/service/gunicorn_web/log/run index 653aa494e..93656d484 100755 --- a/conf/init/service/gunicorn_web/log/run +++ b/conf/init/service/gunicorn_web/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t gunicorn_web +while read -r msg; do + logger -i -t gunicorn_web "$msg" +done diff --git a/conf/init/service/jwtproxy/log/run b/conf/init/service/jwtproxy/log/run index 2a7df37e7..ce048c9e1 100755 --- a/conf/init/service/jwtproxy/log/run +++ b/conf/init/service/jwtproxy/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t jwtproxy +while read -r msg; do + logger -i -t jwtproxy "$msg" +done diff --git a/conf/init/service/logrotateworker/log/run b/conf/init/service/logrotateworker/log/run index 5df84bd21..2e0851758 100755 --- a/conf/init/service/logrotateworker/log/run +++ b/conf/init/service/logrotateworker/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t logrotateworker +while read -r msg; do + logger -i -t logrotateworker "$msg" +done diff --git a/conf/init/service/nginx/log/run b/conf/init/service/nginx/log/run index 947aad375..5b5eb0680 100755 --- a/conf/init/service/nginx/log/run +++ b/conf/init/service/nginx/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t nginx +while read -r msg; do + logger -i -t nginx "$msg" +done diff --git a/conf/init/service/notificationworker/log/run b/conf/init/service/notificationworker/log/run index b19329c0c..10aa8434c 100755 --- a/conf/init/service/notificationworker/log/run +++ b/conf/init/service/notificationworker/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t notificationworker +while read -r msg; do + logger -i -t notificationworker "$msg" +done diff --git a/conf/init/service/queuecleanupworker/log/run b/conf/init/service/queuecleanupworker/log/run index 7613c152a..c5cdb670d 100755 --- a/conf/init/service/queuecleanupworker/log/run +++ b/conf/init/service/queuecleanupworker/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t queuecleanupworker +while read -r msg; do + logger -i -t queuecleanupworker "$msg" +done diff --git a/conf/init/service/repositoryactioncounter/log/run b/conf/init/service/repositoryactioncounter/log/run index cde5afbd4..e3e8a8a3a 100755 --- a/conf/init/service/repositoryactioncounter/log/run +++ b/conf/init/service/repositoryactioncounter/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t repositoryactioncounter +while read -r msg; do + logger -i -t repositoryactioncounter "$msg" +done diff --git a/conf/init/service/security_notification_worker/log/run b/conf/init/service/security_notification_worker/log/run index aca57bc0a..8d97830b7 100755 --- a/conf/init/service/security_notification_worker/log/run +++ b/conf/init/service/security_notification_worker/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t security_notification_worker +while read -r msg; do + logger -i -t security_notification_worker "$msg" +done diff --git a/conf/init/service/securityworker/log/run b/conf/init/service/securityworker/log/run index b635fa07f..ffc0cf6a0 100755 --- a/conf/init/service/securityworker/log/run +++ b/conf/init/service/securityworker/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t securityworker +while read -r msg; do + logger -i -t securityworker "$msg" +done diff --git a/conf/init/service/service_key_worker/log/run b/conf/init/service/service_key_worker/log/run index 6e931ea1f..88b359d27 100755 --- a/conf/init/service/service_key_worker/log/run +++ b/conf/init/service/service_key_worker/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t service_key_worker +while read -r msg; do + logger -i -t service_key_worker "$msg" +done diff --git a/conf/init/service/storagereplication/log/run b/conf/init/service/storagereplication/log/run index c0a47f6b1..f224efacf 100755 --- a/conf/init/service/storagereplication/log/run +++ b/conf/init/service/storagereplication/log/run @@ -4,4 +4,6 @@ sv check syslog-ng > /dev/null || exit 1 # Start the logger -exec logger -i -t storagereplication +while read -r msg; do + logger -i -t storagereplication "$msg" +done