On 02.06.21 11:38, Christopher Faulet wrote:
Le 6/1/21 à 8:26 PM, Aleksandar Lazic a écrit :
On 01.06.21 14:23, Tim Düsterhus wrote:
Aleks,

On 6/1/21 10:30 AM, Aleksandar Lazic wrote:
This phrasing is understandable to me, but now I'm wondering if this is the best solution. Maybe the already existing user-configurable unique request ID should instead be sent to the SPOE and then logged?

https://cbonte.github.io/haproxy-dconv/2.2/configuration.html#7.3.6-unique-id

The request_counter (%rt) you mentioned could be embedded into this unique-id.

Well this uniqe-id is not send as Stream ID to SPOA receiver, due to this fact can't you debug which stream is the troubled one.

Yes, that's why I suggested that the SPOE is extended to also include this specific ID somewhere (just) for logging purposes.

Yep.
Any opinion from the other community Members?


The SID provided in the SPOE log message is the one used in the SPOP frame header. This way it is possible to match a corresponding log message emitted by the agent.

The "unique-id-format %rt" fix the issue for me.

Regarding the format for this log message, its original purpose was to diagnose problems. Instead of adding custom information, I guess the best would be to have a "log-format" directive. At least to not break existing tools parsing those log messages. But to do so, all part of the current message must be available via log variables and/or sample fetches. And, at first glance, it will be hard to achieve (sample fetches are probably easier though).

Regarding the stream_uniq_id sample fetch, it is a good idea to add it. In fact, when it makes sense, a log variable must also be accessible via a sample fetch. Tim's remarks about the patch are valid. For the scope, INTRN or L4CLI, I don't know. I'm inclined to choose INTRN.

Let me withdrawal my patch because I use the following configs to satisfy  may
requirement.


```
global
    log stdout format raw daemon
    # daemon
    maxconn 20000

defaults
    log     global
    mode    http
    option  httplog
    option  dontlognull
    timeout connect 5000
    timeout client  50000
    timeout server  50000

frontend haproxynode
    bind *:9080
    mode http

    unique-id-format %rt
    http-request set-var(sess.my_fe_path) path
    http-request set-var(sess.my_fe_src) src
    http-request set-var(sess.my_fe_referer) req.hdr(Referer)
    http-request set-var(sess.my_fe_requestedhost) req.hdr(Host)

    # define the spoe agents
    filter spoe engine agent-on-http-req config resources/haproxy/spoe-url.conf
    filter spoe engine agent-on-http-res config resources/haproxy/spoe-url.conf

    # map the spoe response to acl variables
    # acl authenticated var(sess.allevents.info) -m bool

    http-response set-header x-spoe %[var(sess.feevents.info)]
    default_backend streams

backend agent-on-http-req
    mode tcp
    log global

    server spoe 127.0.0.1:9000 check

backend agent-on-http-res
    mode tcp
    log global

    server spoe 127.0.0.1:9000 check

backend streams
    log global

    server socat 127.0.0.1:1234 check
```

```
[agent-on-http-req]
spoe-agent agent-on-http-req

    log global

    messages agent-on-http-req

    option var-prefix feevents

    timeout hello      2s
    timeout idle       2m
    timeout processing 1s

    use-backend agent-on-http-req

spoe-message agent-on-http-req
    args my_path=path my_src=src my_referer=req.hdr(Referer) my_sid=unique-id 
my_req_host=req.hdr(Host)
    event on-frontend-http-request

[agent-on-http-res]
spoe-agent agent-on-http-res

    log global

    messages agent-on-http-res

    option var-prefix feevents

    timeout hello      2s
    timeout idle       2m
    timeout processing 1s

    use-backend agent-on-http-res

spoe-message agent-on-http-res
    args my_path=var(sess.my_fe_path) my_src=src 
my_referer=var(sess.my_fe_referer) my_sid=unique-id 
my_req_host=var(sess.my_fe_requestedhost)
    event on-http-response
```

Reply via email to