@@ -2096,33 +2096,27 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
20962096 if (alertif_too_many_args_idx (1 , 1 , file , linenum , args , & err_code ))
20972097 goto out ;
20982098 }
2099- if (curproxy -> conf . logformat_string && curproxy -> cap & PR_CAP_DEF ) {
2099+ if (curproxy -> logformat . str && curproxy -> cap & PR_CAP_DEF ) {
21002100 char * oldlogformat = "log-format" ;
21012101 char * clflogformat = "" ;
21022102
2103- if (curproxy -> conf . logformat_string == default_http_log_format )
2103+ if (curproxy -> logformat . str == default_http_log_format )
21042104 oldlogformat = "option httplog" ;
2105- else if (curproxy -> conf . logformat_string == default_tcp_log_format )
2105+ else if (curproxy -> logformat . str == default_tcp_log_format )
21062106 oldlogformat = "option tcplog" ;
2107- else if (curproxy -> conf . logformat_string == clf_http_log_format )
2107+ else if (curproxy -> logformat . str == clf_http_log_format )
21082108 oldlogformat = "option httplog clf" ;
2109- else if (curproxy -> conf . logformat_string == default_https_log_format )
2109+ else if (curproxy -> logformat . str == default_https_log_format )
21102110 oldlogformat = "option httpslog" ;
21112111 if (logformat == clf_http_log_format )
21122112 clflogformat = " clf" ;
21132113 ha_warning ("parsing [%s:%d]: 'option httplog%s' overrides previous '%s' in 'defaults' section.\n" ,
21142114 file , linenum , clflogformat , oldlogformat );
21152115 }
2116- if (curproxy -> conf .logformat_string != default_http_log_format &&
2117- curproxy -> conf .logformat_string != default_tcp_log_format &&
2118- curproxy -> conf .logformat_string != clf_http_log_format &&
2119- curproxy -> conf .logformat_string != default_https_log_format )
2120- free (curproxy -> conf .logformat_string );
2121- curproxy -> conf .logformat_string = logformat ;
2122-
2123- free (curproxy -> conf .lfs_file );
2124- curproxy -> conf .lfs_file = strdup (curproxy -> conf .args .file );
2125- curproxy -> conf .lfs_line = curproxy -> conf .args .line ;
2116+ lf_expr_deinit (& curproxy -> logformat );
2117+ curproxy -> logformat .str = logformat ;
2118+ curproxy -> logformat .conf .file = strdup (curproxy -> conf .args .file );
2119+ curproxy -> logformat .conf .line = curproxy -> conf .args .line ;
21262120
21272121 if (!(curproxy -> cap & PR_CAP_DEF ) && !(curproxy -> cap & PR_CAP_FE )) {
21282122 ha_warning ("parsing [%s:%d] : backend '%s' : 'option httplog' directive is ignored in backends.\n" ,
@@ -2131,31 +2125,25 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
21312125 }
21322126 }
21332127 else if (strcmp (args [1 ], "tcplog" ) == 0 ) {
2134- if (curproxy -> conf . logformat_string && curproxy -> cap & PR_CAP_DEF ) {
2128+ if (curproxy -> logformat . str && curproxy -> cap & PR_CAP_DEF ) {
21352129 char * oldlogformat = "log-format" ;
21362130
2137- if (curproxy -> conf . logformat_string == default_http_log_format )
2131+ if (curproxy -> logformat . str == default_http_log_format )
21382132 oldlogformat = "option httplog" ;
2139- else if (curproxy -> conf . logformat_string == default_tcp_log_format )
2133+ else if (curproxy -> logformat . str == default_tcp_log_format )
21402134 oldlogformat = "option tcplog" ;
2141- else if (curproxy -> conf . logformat_string == clf_http_log_format )
2135+ else if (curproxy -> logformat . str == clf_http_log_format )
21422136 oldlogformat = "option httplog clf" ;
2143- else if (curproxy -> conf . logformat_string == default_https_log_format )
2137+ else if (curproxy -> logformat . str == default_https_log_format )
21442138 oldlogformat = "option httpslog" ;
21452139 ha_warning ("parsing [%s:%d]: 'option tcplog' overrides previous '%s' in 'defaults' section.\n" ,
21462140 file , linenum , oldlogformat );
21472141 }
21482142 /* generate a detailed TCP log */
2149- if (curproxy -> conf .logformat_string != default_http_log_format &&
2150- curproxy -> conf .logformat_string != default_tcp_log_format &&
2151- curproxy -> conf .logformat_string != clf_http_log_format &&
2152- curproxy -> conf .logformat_string != default_https_log_format )
2153- free (curproxy -> conf .logformat_string );
2154- curproxy -> conf .logformat_string = default_tcp_log_format ;
2155-
2156- free (curproxy -> conf .lfs_file );
2157- curproxy -> conf .lfs_file = strdup (curproxy -> conf .args .file );
2158- curproxy -> conf .lfs_line = curproxy -> conf .args .line ;
2143+ lf_expr_deinit (& curproxy -> logformat );
2144+ curproxy -> logformat .str = default_tcp_log_format ;
2145+ curproxy -> logformat .conf .file = strdup (curproxy -> conf .args .file );
2146+ curproxy -> logformat .conf .line = curproxy -> conf .args .line ;
21592147
21602148 if (alertif_too_many_args_idx (0 , 1 , file , linenum , args , & err_code ))
21612149 goto out ;
@@ -2170,30 +2158,24 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
21702158 char * logformat ;
21712159 /* generate a complete HTTP log */
21722160 logformat = default_https_log_format ;
2173- if (curproxy -> conf . logformat_string && curproxy -> cap & PR_CAP_DEF ) {
2161+ if (curproxy -> logformat . str && curproxy -> cap & PR_CAP_DEF ) {
21742162 char * oldlogformat = "log-format" ;
21752163
2176- if (curproxy -> conf . logformat_string == default_http_log_format )
2164+ if (curproxy -> logformat . str == default_http_log_format )
21772165 oldlogformat = "option httplog" ;
2178- else if (curproxy -> conf . logformat_string == default_tcp_log_format )
2166+ else if (curproxy -> logformat . str == default_tcp_log_format )
21792167 oldlogformat = "option tcplog" ;
2180- else if (curproxy -> conf . logformat_string == clf_http_log_format )
2168+ else if (curproxy -> logformat . str == clf_http_log_format )
21812169 oldlogformat = "option httplog clf" ;
2182- else if (curproxy -> conf . logformat_string == default_https_log_format )
2170+ else if (curproxy -> logformat . str == default_https_log_format )
21832171 oldlogformat = "option httpslog" ;
21842172 ha_warning ("parsing [%s:%d]: 'option httplog' overrides previous '%s' in 'defaults' section.\n" ,
21852173 file , linenum , oldlogformat );
21862174 }
2187- if (curproxy -> conf .logformat_string != default_http_log_format &&
2188- curproxy -> conf .logformat_string != default_tcp_log_format &&
2189- curproxy -> conf .logformat_string != clf_http_log_format &&
2190- curproxy -> conf .logformat_string != default_https_log_format )
2191- free (curproxy -> conf .logformat_string );
2192- curproxy -> conf .logformat_string = logformat ;
2193-
2194- free (curproxy -> conf .lfs_file );
2195- curproxy -> conf .lfs_file = strdup (curproxy -> conf .args .file );
2196- curproxy -> conf .lfs_line = curproxy -> conf .args .line ;
2175+ lf_expr_deinit (& curproxy -> logformat );
2176+ curproxy -> logformat .str = logformat ;
2177+ curproxy -> logformat .conf .file = strdup (curproxy -> conf .args .file );
2178+ curproxy -> logformat .conf .line = curproxy -> conf .args .line ;
21972179
21982180 if (!(curproxy -> cap & PR_CAP_DEF ) && !(curproxy -> cap & PR_CAP_FE )) {
21992181 ha_warning ("parsing [%s:%d] : backend '%s' : 'option httpslog' directive is ignored in backends.\n" ,
@@ -2591,14 +2573,12 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
25912573 err_code |= ERR_ALERT | ERR_FATAL ;
25922574 goto out ;
25932575 }
2594- free ( curproxy -> conf . uniqueid_format_string );
2595- curproxy -> conf . uniqueid_format_string = strdup (args [1 ]);
2596- if (!curproxy -> conf . uniqueid_format_string )
2576+ lf_expr_deinit ( & curproxy -> format_unique_id );
2577+ curproxy -> format_unique_id . str = strdup (args [1 ]);
2578+ if (!curproxy -> format_unique_id . str )
25972579 goto alloc_error ;
2598-
2599- free (curproxy -> conf .uif_file );
2600- curproxy -> conf .uif_file = strdup (curproxy -> conf .args .file );
2601- curproxy -> conf .uif_line = curproxy -> conf .args .line ;
2580+ curproxy -> format_unique_id .conf .file = strdup (curproxy -> conf .args .file );
2581+ curproxy -> format_unique_id .conf .line = curproxy -> conf .args .line ;
26022582 }
26032583
26042584 else if (strcmp (args [0 ], "unique-id-header" ) == 0 ) {
@@ -2630,32 +2610,26 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
26302610 err_code |= ERR_ALERT | ERR_FATAL ;
26312611 goto out ;
26322612 }
2633- if (curproxy -> conf . logformat_string && curproxy -> cap & PR_CAP_DEF ) {
2613+ if (curproxy -> logformat . str && curproxy -> cap & PR_CAP_DEF ) {
26342614 char * oldlogformat = "log-format" ;
26352615
2636- if (curproxy -> conf . logformat_string == default_http_log_format )
2616+ if (curproxy -> logformat . str == default_http_log_format )
26372617 oldlogformat = "option httplog" ;
2638- else if (curproxy -> conf . logformat_string == default_tcp_log_format )
2618+ else if (curproxy -> logformat . str == default_tcp_log_format )
26392619 oldlogformat = "option tcplog" ;
2640- else if (curproxy -> conf . logformat_string == clf_http_log_format )
2620+ else if (curproxy -> logformat . str == clf_http_log_format )
26412621 oldlogformat = "option httplog clf" ;
2642- else if (curproxy -> conf . logformat_string == default_https_log_format )
2622+ else if (curproxy -> logformat . str == default_https_log_format )
26432623 oldlogformat = "option httpslog" ;
26442624 ha_warning ("parsing [%s:%d]: 'log-format' overrides previous '%s' in 'defaults' section.\n" ,
26452625 file , linenum , oldlogformat );
26462626 }
2647- if (curproxy -> conf .logformat_string != default_http_log_format &&
2648- curproxy -> conf .logformat_string != default_tcp_log_format &&
2649- curproxy -> conf .logformat_string != clf_http_log_format &&
2650- curproxy -> conf .logformat_string != default_https_log_format )
2651- free (curproxy -> conf .logformat_string );
2652- curproxy -> conf .logformat_string = strdup (args [1 ]);
2653- if (!curproxy -> conf .logformat_string )
2627+ lf_expr_deinit (& curproxy -> logformat );
2628+ curproxy -> logformat .str = strdup (args [1 ]);
2629+ if (!curproxy -> logformat .str )
26542630 goto alloc_error ;
2655-
2656- free (curproxy -> conf .lfs_file );
2657- curproxy -> conf .lfs_file = strdup (curproxy -> conf .args .file );
2658- curproxy -> conf .lfs_line = curproxy -> conf .args .line ;
2631+ curproxy -> logformat .conf .file = strdup (curproxy -> conf .args .file );
2632+ curproxy -> logformat .conf .line = curproxy -> conf .args .line ;
26592633
26602634 /* get a chance to improve log-format error reporting by
26612635 * reporting the correct line-number when possible.
@@ -2678,15 +2652,12 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
26782652 goto out ;
26792653 }
26802654
2681- if (curproxy -> conf .logformat_sd_string != default_rfc5424_sd_log_format )
2682- free (curproxy -> conf .logformat_sd_string );
2683- curproxy -> conf .logformat_sd_string = strdup (args [1 ]);
2684- if (!curproxy -> conf .logformat_sd_string )
2655+ lf_expr_deinit (& curproxy -> logformat_sd );
2656+ curproxy -> logformat_sd .str = strdup (args [1 ]);
2657+ if (!curproxy -> logformat_sd .str )
26852658 goto alloc_error ;
2686-
2687- free (curproxy -> conf .lfsd_file );
2688- curproxy -> conf .lfsd_file = strdup (curproxy -> conf .args .file );
2689- curproxy -> conf .lfsd_line = curproxy -> conf .args .line ;
2659+ curproxy -> logformat_sd .conf .file = strdup (curproxy -> conf .args .file );
2660+ curproxy -> logformat_sd .conf .line = curproxy -> conf .args .line ;
26902661
26912662 /* get a chance to improve log-format-sd error reporting by
26922663 * reporting the correct line-number when possible.
@@ -2708,18 +2679,17 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
27082679 err_code |= ERR_ALERT | ERR_FATAL ;
27092680 goto out ;
27102681 }
2711- if (curproxy -> conf . error_logformat_string && curproxy -> cap & PR_CAP_DEF ) {
2682+ if (curproxy -> logformat_error . str && curproxy -> cap & PR_CAP_DEF ) {
27122683 ha_warning ("parsing [%s:%d]: 'error-log-format' overrides previous 'error-log-format' in 'defaults' section.\n" ,
27132684 file , linenum );
27142685 }
2715- free ( curproxy -> conf . error_logformat_string );
2716- curproxy -> conf . error_logformat_string = strdup (args [1 ]);
2717- if (!curproxy -> conf . error_logformat_string )
2686+ lf_expr_deinit ( & curproxy -> logformat_error );
2687+ curproxy -> logformat_error . str = strdup (args [1 ]);
2688+ if (!curproxy -> logformat_error . str )
27182689 goto alloc_error ;
27192690
2720- free (curproxy -> conf .elfs_file );
2721- curproxy -> conf .elfs_file = strdup (curproxy -> conf .args .file );
2722- curproxy -> conf .elfs_line = curproxy -> conf .args .line ;
2691+ curproxy -> logformat_error .conf .file = strdup (curproxy -> conf .args .file );
2692+ curproxy -> logformat_error .conf .line = curproxy -> conf .args .line ;;
27232693
27242694 /* get a chance to improve log-format error reporting by
27252695 * reporting the correct line-number when possible.
0 commit comments