Promtail:“发送批次时出错,将重试”status=500

Pau*_*yer 3 grafana-loki promtail

启动 promtail 客户端时,出现错误: component=client host=loki:3100 msg="发送批处理时出错,将重试" status=500 error="服务器返回 HTTP 状态 500 内部服务器错误 (500): rpc 错误: code = ResourceExhausted desc = grpc:收到的消息大于最大值(6780207 与 4194304)”

promtail 配置

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: 'http://loki:3100/loki/api/v1/push'


scrape_configs:
  - job_name: server-log
    pipeline_stages:
    static_configs:
      - targets:
          - localhost
        labels:
          job:  server-log
          __path__: /opt/log/*.log
          __path_exclude__: /opt/log/jck_*,*.log

Run Code Online (Sandbox Code Playgroud)

我尝试开始更改服务器上的限制,并使用参数运行 promtail:

/usr/local/bin/promtail-linux-amd64 -config.file=/etc/config-promtail.yml -server.grpc-max-recv-msg-size-bytes 16777216 -server.grpc-max-concurrent-streams 0 -server.grpc-max-send-msg-size-bytes 16777216 -limit.readline-rate-drop -client.batch-size-bytes 2048576

但根据我发现的情况来看,这是一个 grpc 协议错误,或者更确切地说,是传输消息的大小错误,其中最大为 4 mb

Pau*_*yer 5

更改服务器参数(而不是客户端)解决了问题

server:
  http_listen_port: 3100
  grpc_listen_port: 9096
  grpc_server_max_recv_msg_size: 8388608
  grpc_server_max_send_msg_size: 8388608

limits_config:
  ingestion_rate_mb: 15
  ingestion_burst_size_mb: 30
  per_stream_rate_limit: 10MB
  per_stream_rate_limit_burst: 20MB
  reject_old_samples: true
  reject_old_samples_max_age: 168h
  retention_period: 744h
  max_query_length: 0h

Run Code Online (Sandbox Code Playgroud)