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
Config-related metrics #4420
Config-related metrics #4420
Conversation
This is a cool feature. The only question I have was about using git commit ids in place of |
The GlobalConfig ID consists of an optional user-supplied ID and the SHA256 hash of the full preprocessed configuration. The user-supplied part can be specified using the `@config-id` pragma, for example: @config-id: cfg-20230404-13-ge1602deee Signed-off-by: László Várady <laszlo.varady@anno.io>
Signed-off-by: László Várady <laszlo.varady@anno.io>
I've added a It might sound like a terrible overkill, but I think this unit will be useful in the future (we may want to do some additional clever actions when detecting a configuration change on disk). |
…econds" Signed-off-by: László Várady <laszlo.varady@anno.io>
Signed-off-by: László Várady <laszlo.varady@anno.io>
@kira-syslogng do stresstest |
I've updated the PR description according to my changes. |
This class can be used to be notified about config file changes on the disk. Currently, only the main config file is monitored, and the modification event is emitted based on st_mtime. Signed-off-by: László Várady <laszlo.varady@anno.io>
…onds" Signed-off-by: László Várady <laszlo.varady@anno.io>
Signed-off-by: László Várady <laszlo.varady@anno.io>
@kira-syslogng do stresstest |
Kira-stress-test: Build SUCCESS |
static void | ||
_cfg_file_modified(const CfgMonitorEvent *event, gpointer c) | ||
{ | ||
MainLoop *self = (MainLoop *) c; | ||
|
||
stats_counter_set(self->metrics.last_cfgfile_mtime, (gsize) event->st.st_mtime); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick]
I would add a check for event->event == MODIFIED
, just to be sure we do not break this accidentally in the future.
New configuration-related metrics
The main config file is monitored by
CfgMonitor
with inotify.If inotify fails or is not available, the config is polled every 15 minutes.
syslog-ng configuration identifier
A new syslog-ng configuration keyword has been added, which allows specifying a config identifier. For example:
This keyword can be used for config identification in managed environments, where syslog-ng instances and their
configuration are deployed/generated automatically.
syslog-ng-ctl config --id
can be used to query the active configuration ID and the SHA256 hash of the full"preprocessed" syslog-ng configuration. For example: