mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: log: add "option host" log-forward option
add only the parsing part, options are currently unused
This commit is contained in:
parent
47f14be9f3
commit
003fe530ae
@ -172,7 +172,15 @@ enum PR_SRV_STATE_FILE {
|
||||
#define PR_O3_DONTPARSELOG 0x00000001 /* don't parse log messages */
|
||||
#define PR_O3_ASSUME_RFC6587_NTF 0x00000002 /* assume that we are going to receive just non-transparent framing messages */
|
||||
|
||||
/* unused: 0x00000004 to 0x80000000 */
|
||||
/* unused: 0x00000004 to 0x00000008 */
|
||||
|
||||
#define PR_O3_LOGF_HOST_REPLACE 0x00000010
|
||||
#define PR_O3_LOGF_HOST_FILL 0x00000020
|
||||
#define PR_O3_LOGF_HOST_KEEP 0x00000040
|
||||
#define PR_O3_LOGF_HOST_APPEND 0x00000080
|
||||
#define PR_O3_LOGF_HOST 0x000000F0
|
||||
|
||||
/* unused: 0x00000100 to 0x80000000 */
|
||||
/* end of proxy->options3 */
|
||||
|
||||
/* Cookie settings for pr->ck_opts */
|
||||
|
35
src/log.c
35
src/log.c
@ -6229,6 +6229,41 @@ int cfg_parse_log_forward(const char *file, int linenum, char **args, int kwm)
|
||||
if (err_code & ERR_CODE)
|
||||
goto out;
|
||||
|
||||
|
||||
if (strcmp(args[1], "host") == 0) {
|
||||
int value = 0;
|
||||
|
||||
if (strcmp(args[2], "replace") == 0)
|
||||
value = PR_O3_LOGF_HOST_REPLACE;
|
||||
else if (strcmp(args[2], "fill") == 0)
|
||||
value = PR_O3_LOGF_HOST_FILL;
|
||||
else if (strcmp(args[2], "keep") == 0)
|
||||
value = PR_O3_LOGF_HOST_KEEP;
|
||||
else if (strcmp(args[2], "append") == 0)
|
||||
value = PR_O3_LOGF_HOST_APPEND;
|
||||
|
||||
if (!value) {
|
||||
ha_alert("parsing [%s:%d] : option 'host' expects {replace|fill|keep|append}.\n", file, linenum);
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
cfg_log_forward->options3 &= ~PR_O3_LOGF_HOST;
|
||||
cfg_log_forward->no_options3 &= ~PR_O3_LOGF_HOST;
|
||||
|
||||
switch (kwm) {
|
||||
case KWM_STD:
|
||||
cfg_log_forward->options3 |= value;
|
||||
break;
|
||||
case KWM_NO:
|
||||
cfg_log_forward->no_options3 |= value;
|
||||
break;
|
||||
case KWM_DEF: /* already cleared */
|
||||
break;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
ha_alert("parsing [%s:%d] : unknown option '%s' in log-forward section.\n", file, linenum, args[1]);
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user