]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: spoe-agent: properly postresolve log rings
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 4 Jul 2023 15:49:19 +0000 (17:49 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Sep 2023 14:06:39 +0000 (16:06 +0200)
Now that we have sink_postresolve_logsrvs() function, we make use of it
for spoe-agent log postparsing logic.

This will allow this kind of config to work:
  |spoe-agent test
  |        log tcp@127.0.0.1:514 local0
  |        use-backend xxx

Plus, consistency checks will also be performed as for regular log
directives used from global, log-forward or proxy sections.

src/flt_spoe.c

index 6fc3023c2a9519fffc0a3784a81cd9ed63c10b00..f171f065c8e0c6edbaab04faf54f6dad26e5557b 100644 (file)
@@ -3065,7 +3065,6 @@ spoe_check(struct proxy *px, struct flt_conf *fconf)
        struct flt_conf    *f;
        struct spoe_config *conf = fconf->conf;
        struct proxy       *target;
-       struct logsrv      *logsrv;
        int i;
 
        /* Check all SPOE filters for proxy <px> to be sure all SPOE agent names
@@ -3120,20 +3119,8 @@ spoe_check(struct proxy *px, struct flt_conf *fconf)
                HA_SPIN_INIT(&conf->agent->rt[i].lock);
        }
 
-       list_for_each_entry(logsrv, &conf->agent_fe.logsrvs, list) {
-               if (logsrv->type == LOG_TARGET_BUFFER) {
-                       struct sink *sink = sink_find(logsrv->ring_name);
-
-                       if (!sink || sink->type != SINK_TYPE_BUFFER) {
-                               ha_alert("Proxy %s : log server used by SPOE agent '%s' declared"
-                                        " at %s:%d uses unknown ring named '%s'.\n",
-                                        px->id, conf->agent->id, conf->agent->conf.file,
-                                        conf->agent->conf.line, logsrv->ring_name);
-                               return 1;
-                       }
-                       logsrv->sink = sink;
-               }
-       }
+       if (postresolve_logsrv_list(&conf->agent_fe.logsrvs, "SPOE agent", conf->agent->id) & ERR_CODE)
+               return 1;
 
        ha_free(&conf->agent->b.name);
        conf->agent->b.be = target;