syslog-ng icon indicating copy to clipboard operation
syslog-ng copied to clipboard

Set loglevels from config

Open bazsi opened this issue 2 years ago • 7 comments

This patch adds a feature to control the internal verbosity of syslog-ng (e.g. verbose, debug, trace) via the configuration file.

Example:

    options {
      log-level(debug);
    };

Possible values for log-level: - default, just normal log messages - verbose, normal + messages that get enabled via -v - debug, verbose + messages that get enabled via -d - trace, debug + messages that get enabled via -t

If the option is unset, we leave the settings as specified on the command line.

If we have log-level(default) it would override settings specified via the command line.

Rationale: in containerized environments, it is much easier to override log verbosity settings via the config file than via changing the command line options.

bazsi avatar Jul 29 '22 10:07 bazsi

No news file has been detected. Please write one, if applicable.

github-actions[bot] avatar Jul 29 '22 10:07 github-actions[bot]

This pull request introduces 1 alert when merging 20c4f4daafa815b8a178b47e1dd85fa983388641 into d8d8d0fced4b05ff22ee47f408ab6ddafd8965a8 - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

lgtm-com[bot] avatar Jul 29 '22 11:07 lgtm-com[bot]

Shouldn't we work the other way around? Command line options are usually stronger than configuration file options as they are easier to modify. For example, starting syslog-ng with -d is much quicker than removing/changing the option in the config.

AFAIK other tools work similarly, for example, nginx has a command line flag to override a few directives inside the config file.

MrAnno avatar Jul 29 '22 16:07 MrAnno

Good point.

On Fri, Jul 29, 2022, 18:29 László Várady @.***> wrote:

Shouldn't we work the other way around? Command line options are usually stronger than configuration file options as they are easier to modify. For example, starting syslog-ng with -d is much quicker than removing/changing the option in the config.

AFAIK other tools work similarly, for example, nginx has an option to override a few directives inside the config file.

— Reply to this email directly, view it on GitHub https://github.com/syslog-ng/syslog-ng/pull/4091#issuecomment-1199683855, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFOK5RUSHEABRG6WZXKY73VWQBH3ANCNFSM55ALLVVQ . You are receiving this because you authored the thread.Message ID: @.***>

bazsi avatar Jul 29 '22 21:07 bazsi

Build FAILURE

kira-syslogng avatar Aug 04 '22 18:08 kira-syslogng

Build FAILURE

kira-syslogng avatar Aug 07 '22 06:08 kira-syslogng

Build FAILURE

kira-syslogng avatar Aug 07 '22 11:08 kira-syslogng

Build FAILURE

kira-syslogng avatar Aug 24 '22 11:08 kira-syslogng

@kira-syslogng seems to build on the response from "syslog-ng-ctl debug" which was changed by this PR. Can anyone help me with fixing that dependency?

bazsi avatar Aug 24 '22 12:08 bazsi

Build FAILURE

kira-syslogng avatar Aug 24 '22 12:08 kira-syslogng

@bazsi Of course. I'll take a look at this next week.

MrAnno avatar Aug 28 '22 20:08 MrAnno

Build FAILURE

kira-syslogng avatar Sep 01 '22 15:09 kira-syslogng

@kira-syslogng test this please test branch=followup_log_level_changes; test=functions/tools/syslog-ng-ctl/;

mitzkia avatar Sep 02 '22 07:09 mitzkia

Build FAILURE

kira-syslogng avatar Sep 02 '22 08:09 kira-syslogng

@kira-syslogng test this please test branch=followup_log_level_changes; test=functions/tools/syslog-ng-ctl/;

mitzkia avatar Sep 02 '22 14:09 mitzkia

Build FAILURE

kira-syslogng avatar Sep 02 '22 15:09 kira-syslogng

@kira-syslogng test this please test branch=followup_log_level_changes;

MrAnno avatar Sep 02 '22 15:09 MrAnno

Build FAILURE

kira-syslogng avatar Sep 02 '22 15:09 kira-syslogng

I'm just thinking out loud: This PR deliberately replaces our composable diagnostic flags -Fdevt with a more straightforward approach: log levels.

This means that the -Fdevt is not considered useful anymore as -Fet produces the same level.

In that case, we could say that the old syslog-ng-ctl commands are just for backward compatibility (deprecated), log-level should be used instead. I think the same is true for the command line flags: Since using -dvt is not intuitive anymore either, a --log-level flag would be really useful and could maintain a consistent feel.

MrAnno avatar Sep 02 '22 16:09 MrAnno

@bazsi What do you think?

MrAnno avatar Sep 09 '22 11:09 MrAnno

Build FAILURE

kira-syslogng avatar Sep 09 '22 14:09 kira-syslogng

@bazsi What do you think?

done.

bazsi avatar Sep 09 '22 14:09 bazsi

@kira-syslogng test this please test branch=followup_log_level_changes;

bazsi avatar Sep 12 '22 16:09 bazsi

Build FAILURE

kira-syslogng avatar Sep 12 '22 16:09 kira-syslogng

Just for the record about the latest failing Kira job. Somehow Jenkins clones out not the PR itself, but the master branch, and because of this the test assertion fails. In the other Kira test job everything is ok, new testcase assertion passes on PR changes.

mitzkia avatar Sep 15 '22 11:09 mitzkia

@kira-syslogng test this please test branch=followup_log_level_changes;

mitzkia avatar Sep 16 '22 09:09 mitzkia

Build FAILURE

kira-syslogng avatar Sep 16 '22 09:09 kira-syslogng

@kira-syslogng test this please test branch=followup_log_level_changes;

mitzkia avatar Sep 16 '22 09:09 mitzkia

Latest Kira-starter job runs correctly (I have fixed the Kira job):

  • it uses this PR as a source in both cases (cmake and autotools build), and
  • the correct topic branch for testdb

mitzkia avatar Sep 16 '22 11:09 mitzkia

Thanks @mitzkia

With that I think we can merge this once it gets a thumbs up from someone.

bazsi avatar Sep 18 '22 05:09 bazsi