From 911a602c7936a029a34ed71835d12ff4a5940934 Mon Sep 17 00:00:00 2001 From: Samuel Boucher Date: Tue, 1 Nov 2016 15:08:11 -0400 Subject: [PATCH] Update syslog_json.py Add SYSLOG_FACILITY environment variable to set syslog facility --- lib/ansible/plugins/callback/syslog_json.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/callback/syslog_json.py b/lib/ansible/plugins/callback/syslog_json.py index 6b5fc60bdcc..dfb8ae84eb7 100644 --- a/lib/ansible/plugins/callback/syslog_json.py +++ b/lib/ansible/plugins/callback/syslog_json.py @@ -22,6 +22,7 @@ class CallbackModule(CallbackBase): This plugin makes use of the following environment variables: SYSLOG_SERVER (optional): defaults to localhost SYSLOG_PORT (optional): defaults to 514 + SYSLOG_FACILITY (optional): defaults to user """ CALLBACK_VERSION = 2.0 CALLBACK_TYPE = 'aggregate' @@ -38,7 +39,7 @@ class CallbackModule(CallbackBase): self.handler = logging.handlers.SysLogHandler( address = (os.getenv('SYSLOG_SERVER','localhost'), os.getenv('SYSLOG_PORT',514)), - facility=logging.handlers.SysLogHandler.LOG_USER + facility= os.getenv('SYSLOG_FACILITY',logging.handlers.SysLogHandler.LOG_USER) ) self.logger.addHandler(self.handler) self.hostname = socket.gethostname()