-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Log runtime configuration on SIGUSR2 #36
Comments
Hi Simon, I should certainly be possible to add a custom SIGUSR2 handler (on any/all processes). What format should the logged output be in? Same as Also to clarify, you mean a dump of all the current config options (like
Cheers, |
Hi Maxim, I'm not sure about the format in syslog, so maybe something without lots of spaces or tabs, like so:
What do you think? The The problem which could be solved with the SIGUSR2 is that you can lose track on what your currently running instance is running exactly. Maybe you modified several config files and you don't know if your running instance is up to date. Maybe you forgot to send SIGHUP or you don't remember whether you did it or not. Just send a SIGUSR2 and you can read the running config in the logs. Regards, |
Hi Maxim, Wow that's cool and it works very well, thanks! Sorry to be a pain but the ideas are just coming while testing:
What do you think? |
Hi Simon,
Done. And yes the extra spaces are ignored in config files. As for the 2nd point, the "problem" is that the defaults are only known before any config options are processed. IOW the default values aren't stored separately anywhere, so once config options are processed, the defaults are effectively unknown. We could of course store the defaults as a copy somewhere and keep them loaded, and then we could present them as you suggest. But I'm not really sure the extra complexity or storage space is warranted... Ultimately a So, I'm undecided on that 2nd part but open to further arguments for it... :) -Max |
Hi Maxim, From trying to understand the code I thought it's how you describe it. My idea was to store the initial config into a defaults variable/array/object at startup and keep it. Then, when doing the Would this be possible without too much headaches? Thanks, |
Hi Maxim, Ping, are you still looking into this? If not, it's also fine as the current version works very well. Thanks, |
Hi Simon, I was looking for some justification for implementing all this, but haven't really heard it. Even my current version (from the related PR) has an issue that it cannot properly display some config settings because the variables have already been overwritten (eg. everything stored in the Best, |
No problem, I like the way it is now but I can also live without the feature. Regards, |
Hi Maxim,
I'm coming back to you with an idea to improve configuration management.
While we can use
spampd --show config
to show the current config, it shows only the config options defined in config files.Would it be possible to add a signal handler so that one can send a SIGUSR2 to the master spampd process to it will send the current runtime config to the log? (The idea is shamelessly taken from OpenVPN which logs statistics on SIGUSR2)
That way it would be possible to see what spampd really runs, even with a combination of command options and config files.
Unfortunately I don't know perl enough to do this myself. I saw that Net::Server handles HUP and provides a hook for it but is it possible to handle USR2 with Net::Server?
Thanks,
Simon
The text was updated successfully, but these errors were encountered: