Getting 413 error trying to send logs to Loki

Hi,

I’m using Grafana Alloy to recollect and send the logs to Loki. I’m getting this error when the Alloy tries to send some logs:

server returned HTTP status 413 Request Entity Too Large (413): <html>

I’m using Helm to deploy Loki and this is my configuration for the loki-gateway:

gateway:
  enabled: true
  replicas: 6
  verboseLogging: true
  annotations:
    nginx.ingress.kubernetes.io/proxy-read-timeout: '1800'
    nginx.ingress.kubernetes.io/proxy-send-timeout: '500'
    nginx.ingress.kubernetes.io/proxy-connect-timeout: '500'
    nginx.ingress.kubernetes.io/client-header-timeout: '500'
    nginx.ingress.kubernetes.io/client-body-timeout: '500'
    nginx.ingress.kubernetes.io/proxy-body-size: '900m'
    nginx.ingress.kubernetes.io/proxy-request-buffering: off
  service:
    port: 80
    type: NodePort
    clusterIP: null
    nodePort: 30001
    loadBalancerIP: null
    annotations: {}
    labels: {}

Does someone know what I can do?

How big are your logs on average per line?

There are some limits_config configurations that you might consider tweaking (see Grafana Loki configuration parameters | Grafana Loki documentation):

ingestion_rate_strategy (try setting to local)
ingestion_rate_mb
ingestion_burst_size_mb
max_line_size
per_stream_rate_limit
per_stream_rate_limit_burst

This is my current limit configuration that have been working to me so far:

ingestion_rate_mb: 170
ingestion_burst_size_mb: 175
max_line_size: 0
per_stream_rate_limit: 40MB
per_stream_rate_limit_burst: 70MB