mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 07:01:22 -07:00
Update syslog_json.py
Add SYSLOG_FACILITY environment variable to set syslog facility
This commit is contained in:
parent
b7e6ace4ee
commit
911a602c79
1 changed files with 2 additions and 1 deletions
|
@ -22,6 +22,7 @@ class CallbackModule(CallbackBase):
|
||||||
This plugin makes use of the following environment variables:
|
This plugin makes use of the following environment variables:
|
||||||
SYSLOG_SERVER (optional): defaults to localhost
|
SYSLOG_SERVER (optional): defaults to localhost
|
||||||
SYSLOG_PORT (optional): defaults to 514
|
SYSLOG_PORT (optional): defaults to 514
|
||||||
|
SYSLOG_FACILITY (optional): defaults to user
|
||||||
"""
|
"""
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_VERSION = 2.0
|
||||||
CALLBACK_TYPE = 'aggregate'
|
CALLBACK_TYPE = 'aggregate'
|
||||||
|
@ -38,7 +39,7 @@ class CallbackModule(CallbackBase):
|
||||||
self.handler = logging.handlers.SysLogHandler(
|
self.handler = logging.handlers.SysLogHandler(
|
||||||
address = (os.getenv('SYSLOG_SERVER','localhost'),
|
address = (os.getenv('SYSLOG_SERVER','localhost'),
|
||||||
os.getenv('SYSLOG_PORT',514)),
|
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.logger.addHandler(self.handler)
|
||||||
self.hostname = socket.gethostname()
|
self.hostname = socket.gethostname()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue