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

Add heavy weight config check #4646

Merged
merged 4 commits into from Oct 4, 2023

Conversation

bazsi
Copy link
Collaborator

@bazsi bazsi commented Sep 22, 2023

This should fix #4592

It adds a --check-startup command line option that causes syslog-ng to perform a complete config initialization and then
exit with the exit code indicating the result: 0 indicates complete success, non-zero indicates failure. (1 indicates syntax error, 2 a runtime error)

…e mode

Use interactive_mode() in all cases where we exit before the main loop
is run (e.g. --syntax-only and --preprocess-into). This means that we won't
add timestamps to our stdout when printing errors in case an
interactive session is needed.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
This new option will perform a complete initialization of syslog-ng and
then exit, indicating the success of the initialization. This can be used
when you need to check if opening network ports and the entire
initialization would work or not.

This does not work if you have a syslog-ng running in the background, as
in those cases that would keep the ports open, causing the new one
to unable to open them again.

The success is indicated by an exit code:

When initialization is successful:
$ syslog-ng --check-startup
$ echo $?
0

When it is not:
$ syslog-ng --check-startup
$ echo $?
2

The exit codes match syslog-ng exit codes, e.g. 1 is a syntax error, 2
is a higher level initialization error.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Copy link
Collaborator

@furiel furiel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bazsi bazsi merged commit 8bbcbe5 into syslog-ng:master Oct 4, 2023
19 checks passed
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 this pull request may close these issues.

Runtime configuration check capability
2 participants