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 <wlallem...@haproxy.com>
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

Reply via email to