Ability to change syslog facility to an arbitrary value
I was looking into the syslog integration and best I can tell a user setting a honeycomb.yml in core cannot override (or at least I haven't figured out how to set) a logging.handlers.SysLogHandler.LOG_USER to be something other than "user". I'd like to be able to set this in honeycomb.yml in the integration config to be able to pick a specific facility.
The best integration point I can think of would be to allow a user to override the facility here:
https://github.com/Cymmetria/honeycomb/blob/master/honeycomb.yml#L9-L14
Work-around monkey patch until we have a PR proposed or landed to make this controllable via config...
diff --git a/honeycomb/main.py b/honeycomb/main.py index 79887d4..e2e9578 100644 --- a/honeycomb/main.py +++ b/honeycomb/main.py @@ -12,6 +12,11 @@ import sys
from honeycomb.cli import cli
+# Monkey Patching LOG_USER ##### +import logging +from logging import handlers +logging.handlers.SysLogHandler.LOG_USER = INSERT_LOGGING_FACILITY_INT +### end monkey patch ###
https://en.wikipedia.org/wiki/Syslog
though, I think the better approach would be to import from honeycomb.yaml facility
Hi @claudijd thanks for your suggestion
I think it should be quite easy to just add a parameter to the syslog integration that specifies the facility
This can be done by changing the instantiation here https://github.com/Cymmetria/honeycomb_plugins/blob/master/integrations/syslog/integration.py#L145 to add a facility parameter and change https://github.com/Cymmetria/honeycomb_plugins/blob/master/integrations/syslog/integration.py#L188 to take a parameter from the init function here https://github.com/Cymmetria/honeycomb_plugins/blob/master/integrations/syslog/integration.py#L179
If you could submit a PR with this change we'll be happy to merge it Just remember to add the parameter in https://github.com/Cymmetria/honeycomb_plugins/blob/master/integrations/syslog/config.json
Sure, I'm happy to make that so shortly, probably in the next day or so. Thanks!