]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log: handle extra log origins in _process_send_log_override()
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 31 Jul 2024 12:45:32 +0000 (14:45 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 26 Sep 2024 14:53:07 +0000 (16:53 +0200)
Thanks to the previous commit, it is now possible to register additional
log origins that may be used from log-profile section as 'on' steps.

As such, let's make _process_send_log_override() function aware of them
by trying to lookup in the tree of extra logging steps in the default
switch-case catchall. If the log origin id matches with the id of the
extra logging step, we use the associated log format instead of the
"any" log format.

src/log.c

index e98a8f7197fe2dfa30ceaf16b0e50031bf10fcbd..28c6e5c4d059b3afe986a98d99bb6ee95c96312c 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -2932,7 +2932,18 @@ static inline void _process_send_log_override(struct process_send_log_ctx *ctx,
                                step = prof->close;
                        break;
                default:
+               {
+                       struct log_profile_step_extra *extra;
+
+                       /* catchall for extra log origins */
+
+                       /* check if there is a log step defined for this log origin */
+                       extra = container_of_safe(eb32_lookup(&prof->extra, orig),
+                                                 struct log_profile_step_extra, node);
+                       if (extra)
+                               step = &extra->step;
                        break;
+               }
        }
 
        if (!step && prof->any)