Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to change syslog facility to an arbitrary value #103

Open
claudijd opened this issue Aug 30, 2018 · 5 comments · May be fixed by #104
Open

Ability to change syslog facility to an arbitrary value #103

claudijd opened this issue Aug 30, 2018 · 5 comments · May be fixed by #104

Comments

@claudijd
Copy link

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.

@claudijd
Copy link
Author

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

@claudijd
Copy link
Author

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

@claudijd
Copy link
Author

though, I think the better approach would be to import from honeycomb.yaml facility

@omercnet
Copy link
Contributor

omercnet commented Aug 30, 2018

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

@claudijd
Copy link
Author

Sure, I'm happy to make that so shortly, probably in the next day or so. Thanks!

@claudijd claudijd linked a pull request Aug 30, 2018 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants