Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: when I use the kafka-logger plugin, failed to fetch the time in kafka #5719

Closed
lihuawei321 opened this issue Dec 7, 2021 · 6 comments
Closed
Labels
stale wait for update wait for the author's response in this issue/PR

Comments

@lihuawei321
Copy link

lihuawei321 commented Dec 7, 2021

Issue description

我写入kafka的日志格式是:
[{"client_ip":"192.168.35.122","host":"192.168.9.234","@timestamp":"2021-12-07T10:41:12+08:00","route_id":"363894265081758809"}]
但是kafka显示的没有时间戳
image

Environment

  • apisix version (cmd: apisix version): 2.10
  • OS (cmd: uname -a): centos7
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):
  • etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):
  • apisix-dashboard version, if have: 2.9
  • the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
  • luarocks version, if the issue is about installation (cmd: luarocks --version):
@juzhiyuan
Copy link
Member

Hi, could you please provide more steps so I could reproduce it?

@juzhiyuan juzhiyuan added the wait for update wait for the author's response in this issue/PR label Dec 7, 2021
@membphis membphis changed the title bug: 当我使用kafka-logger插件时候,kafka里没有获取到写入时间 bug: when I use the kafka-logger plugin, failed to fetch the time in kafka Dec 7, 2021
@tzssangglass
Copy link
Member

pls describe it more clearly. From the information you have provided, I do not know what is failed to fetch the time in kafka

@github-actions
Copy link

This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 23, 2022
@github-actions
Copy link

github-actions bot commented Dec 8, 2022

This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2022
@mrostamii
Copy link

I also have the same issue, the created service config is:

{
    "upstream_id": "test-case",
    "name": "test-case",
    "plugins": {
        "kafka-logger": {
            "brokers": [
                {
                    "host": "1.50.0.10",
                    "port": 9092
                },
                {
                    "host": "1.50.0.11",
                    "port": 9092
                },
                {
                    "host": "1.50.0.12",
                    "port": 9092
                }
            ],
            "name": "kafka logger",
            "kafka_topic": "apisix",
            "key": "test-case",
            "batch_max_size": 100,
            "timeout": 3,
            "timestamp": true,
            "log_format": {
                "timestamp": "$time_iso8601",
                "consumer": "$consumer_name",
                "service_id": "$service_id",
                "route_id": "$route_id",
                "request_id": "$request_id",
                "latency": "$request_time",
                "node_hostname": "$hostname",
                "window_start_time": "$time_unix"
            }
        },
        "key-auth": {},
        "cors": {
            "allow_origins": "*",
            "allow_methods": "*",
            "allow_headers": "*",
            "expose_headers": "*"
        },
        "response-rewrite": {
            "headers": {
                "X-Server-IP": "$remote_addr",
                "X-Real-IP": "$http_x_real_ip",
                "X-Forwarded-For": "$http_x_forwarded_for",
                "X-Request-ID": "$request_id",
                "X-Original-URI": "$uri",
                "X-Upstream-IP": "$upstream_addr",
                "X-Upstream-Response-Time": "$upstream_response_time",
                "X-Upstream-Status": "$upstream_status",
                "X-CF-Ray": "$http_cf_ray",
                "X-CF-IPCountry": "$http_cf_ipcountry",
                "X-CF-Connecting-IP": "$http_cf_connecting_ip",
                "X-CF-Visitor": "$http_cf_visitor",
                "X-CF-Request-ID": "$http_cf_request_id",
                "X-APISIX-Upstream-Status": "$upstream_status",
                "X-APISIX-Proxy-Latency": "$upstream_response_time",
                "X-APISIX-Server": "$hostname",
                "X-APISIX-Route-ID": "$route_id",
                "X-APISIX-Consumer-Name": "$consumer_name",
                "X-SSL-Protocol": "$ssl_protocol",
                "X-SSL-Cipher": "$ssl_cipher",
                "X-Scheme": "$scheme",
                "X-Request-Time": "$request_time",
                "X-APISIX-Upstream-Filter-Time": "$upstream_filter_time",
                "X-First-Byte-Time": "$first_byte_time"
            }
        }
    }
}

Version:

apisix: 3.11.0
kafka: 7.4.0

@bfyxzls
Copy link

bfyxzls commented Apr 7, 2025

I also have the same issue, the created service config is:

"log_format": {
    "@timestamp": "$time_iso8601",
    "accessPage": "$http_accessPage",
    "accessSource": "$http_accessSource",
    "api": "$request_uri",
    "appVersion": "$http_appVersion"
  }

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale wait for update wait for the author's response in this issue/PR
Projects
None yet
Development

No branches or pull requests

5 participants