ilogtail icon indicating copy to clipboard operation
ilogtail copied to clipboard

[FEATURE]:flusher_http supports log text output, specifying json field values, such as contents.content

Open clcc2019 opened this issue 8 months ago • 0 comments

Concisely describe the proposed feature I would like flusher_http to support outputting the raw log content by specifying a JSON field value, such as contents.content. This would allow greater flexibility for users who wish to directly transmit a specific field as the complete log content.

Describe the solution you'd like (if any) We could introduce a configuration option in flusher_http like raw_log_field = "contents.content", which will extract and output the specified field’s value as the raw log body. This can be useful when users structure their logs as JSON and only want a certain nested field to be forwarded.

Additional comments ingress-nginx logs.

{
    "contents": {
        "_source_": "stdout",
        "_time_": "2025-04-10T10:02:50.337628167+08:00",
        "body_bytes_sent": "28",
        "host": "",
        "http_referer": "/app/264f4f2e-25ec-4dec-9dc1-fc4c395b16fc/workflow",
        "http_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "proxy_alternative_upstream_name": "",
        "proxy_upstream_name": "default-dify-80",
        "remote_addr": "10.244.0.130",
        "remote_user": "-",
        "req_id": "3351d5c012a47f624e8c0631f102f6de",
        "request": "GET /console/api/apps/264f4f2e-25ec-4dec-9dc1-fc4c395b16fc/workflows/draft/config HTTP/1.1",
        "request_length": "2666",
        "request_time": "0.131",
        "status": "200",
        "time_local": "10/Apr/2025:02:02:50 +0000",
        "upstream_addr": "10.244.1.65:80",
        "upstream_response_length": "28",
        "upstream_response_time": "0.130",
        "upstream_status": "200"
    },
    "tags": {
        "__host_ip__": "10.244.1.190",
        "container.ip": "10.244.1.69",
        "container.name": "controller",
        "host.ip": "10.244.1.190",
        "host.name": "node03",
        "k8s.namespace.name": "default",
        "k8s.node.ip": "10.9.1.13",
        "k8s.node.name": "node03",
        "k8s.pod.name": "ingress-nginx-controller-555c6d4c4b-w5n4g",
        "k8s.pod.uid": "6e4379ca-c58f-479e-baa1-a19f3c2c8456"
    },
    "time": 1744250570
}

I want to report as body:

{
        "_source_": "stdout",
        "_time_": "2025-04-10T10:02:50.337628167+08:00",
        "body_bytes_sent": "28",
        "host": "",
        "http_referer": "/app/264f4f2e-25ec-4dec-9dc1-fc4c395b16fc/workflow",
        "http_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "proxy_alternative_upstream_name": "",
        "proxy_upstream_name": "default-dify-80",
        "remote_addr": "10.244.0.130",
        "remote_user": "-",
        "req_id": "3351d5c012a47f624e8c0631f102f6de",
        "request": "GET /console/api/apps/264f4f2e-25ec-4dec-9dc1-fc4c395b16fc/workflows/draft/config HTTP/1.1",
        "request_length": "2666",
        "request_time": "0.131",
        "status": "200",
        "time_local": "10/Apr/2025:02:02:50 +0000",
        "upstream_addr": "10.244.1.65:80",
        "upstream_response_length": "28",
        "upstream_response_time": "0.130",
        "upstream_status": "200"
}

clcc2019 avatar Apr 10 '25 02:04 clcc2019