Re: Should we change the -c output?
On Tue, Nov 14, 2023 at 02:32:40AM -0500, John Lauro wrote: > I like the default message. If you want to suppress it, then you can use -q. > Having some standard output that can be suppressed with -q is also > fairly standard for UNIX commands. > In haproxy we have these two flags: -q is meant to suppress all the messages, even when the configuration is wrong, that's not the same thing as displaying only the errors. -V is meant to add more output than the default. Till 2.8, the systemd unit was not displaying the errors upon a reload because it was checking the configuration with -q, I'm surprised nobody reported it, because that's really a pain to have a process which reloads incorrectly without showing any error. Problem is, when removing the -q, the script adds "Configuration is valid" to the logs for every reloads, which are already a bit heavy for just a reload. Using -q for this was a problem, so I'd better not do it. I'm not talking about suppressing the message, just hiding the "valid" message by default, without -V. All other warnings and alerts are still outputed, so it's easy to see if you broke something. -- William Lallemand
Re: Should we change the -c output?
I like the default message. If you want to suppress it, then you can use -q. Having some standard output that can be suppressed with -q is also fairly standard for UNIX commands. On Mon, Nov 13, 2023 at 4:07 AM William Lallemand wrote: > > On Mon, Nov 13, 2023 at 09:52:57AM +0100, Baptiste wrote: > > On Thu, Nov 9, 2023 at 5:00 PM William Lallemand > > wrote: > > > > > Hello, > > > > > > haproxy -c seems to be too verbose in the systemd logs by > > > showing "Configuration file is valid" for every reloads. > > > > > > Is there anyone against removing this message by default? > > > This will still output the alerts and warnings if some exists but the > > > "Configuration file is valid" message will only be displayed in > > > combination with -V. > > > > > > People tend to use the return code of the command and not the output, > > > but I prefer to ask. > > > > > > Change will only be applied starting from 2.9. Patch attached. > > > > > > -- > > > William Lallemand > > > > > > > Hi William, > > > > I used to use this message for 13 years while manually checking confs :) > > I think it may impact admins / devs who run these manual checks, but not > > too hard as we all look for "ERROR" or "WARNING" by default. > > I think it's "ok" to change this. I will just miss it :D > > > > Baptiste > > That's what I thought either, and I like it since it's a little bit more > like an UNIX command, which displays nothing when everything is correct. > > I pushed the patch, thanks! > > -- > William Lallemand >
Re: Should we change the -c output?
On Mon, Nov 13, 2023 at 09:52:57AM +0100, Baptiste wrote: > On Thu, Nov 9, 2023 at 5:00 PM William Lallemand > wrote: > > > Hello, > > > > haproxy -c seems to be too verbose in the systemd logs by > > showing "Configuration file is valid" for every reloads. > > > > Is there anyone against removing this message by default? > > This will still output the alerts and warnings if some exists but the > > "Configuration file is valid" message will only be displayed in > > combination with -V. > > > > People tend to use the return code of the command and not the output, > > but I prefer to ask. > > > > Change will only be applied starting from 2.9. Patch attached. > > > > -- > > William Lallemand > > > > Hi William, > > I used to use this message for 13 years while manually checking confs :) > I think it may impact admins / devs who run these manual checks, but not > too hard as we all look for "ERROR" or "WARNING" by default. > I think it's "ok" to change this. I will just miss it :D > > Baptiste That's what I thought either, and I like it since it's a little bit more like an UNIX command, which displays nothing when everything is correct. I pushed the patch, thanks! -- William Lallemand
Re: Should we change the -c output?
On Thu, Nov 9, 2023 at 5:00 PM William Lallemand wrote: > Hello, > > haproxy -c seems to be too verbose in the systemd logs by > showing "Configuration file is valid" for every reloads. > > Is there anyone against removing this message by default? > This will still output the alerts and warnings if some exists but the > "Configuration file is valid" message will only be displayed in > combination with -V. > > People tend to use the return code of the command and not the output, > but I prefer to ask. > > Change will only be applied starting from 2.9. Patch attached. > > -- > William Lallemand > Hi William, I used to use this message for 13 years while manually checking confs :) I think it may impact admins / devs who run these manual checks, but not too hard as we all look for "ERROR" or "WARNING" by default. I think it's "ok" to change this. I will just miss it :D Baptiste
Should we change the -c output?
Hello, haproxy -c seems to be too verbose in the systemd logs by showing "Configuration file is valid" for every reloads. Is there anyone against removing this message by default? This will still output the alerts and warnings if some exists but the "Configuration file is valid" message will only be displayed in combination with -V. People tend to use the return code of the command and not the output, but I prefer to ask. Change will only be applied starting from 2.9. Patch attached. -- William Lallemand >From d189f5473f0ed0594c693646d424d0a9e03eabaf Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Thu, 9 Nov 2023 14:48:50 +0100 Subject: [PATCH] MEDIUM: startup: MODE_CHECK is quiet by default MODE_CHECK does not output "Configuration file is valid" by default anymore. To display this message the -V option must be used with -c. However the warning and errors are still output by default if they exist. This allows to clean the output of the systemd unit file with is doing a -c. --- src/haproxy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/haproxy.c b/src/haproxy.c index 7a4f49fa6..d728f0c21 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2374,7 +2374,8 @@ static void init(int argc, char **argv) if (pr || px) { /* At least one peer or one listener has been found */ - qfprintf(stdout, "Configuration file is valid\n"); + if (global.mode & MODE_VERBOSE) +qfprintf(stdout, "Configuration file is valid\n"); deinit_and_exit(0); } qfprintf(stdout, "Configuration file has no error but will not start (no listener) => exit(2).\n"); -- 2.39.2