title: Remove a part of a log in Loki
body: <p>I have installed Grafana, Loki, Promtail and Prometheus with the <a href="https://github.com/grafana/helm-charts/tree/main/charts/loki-stack" rel="nofollow noreferrer"><code>grafana/loki-stack</code></a>.</p>
  <p>I also have Nginx set up with the <a href="https://github.com/kubernetes/ingress-nginx/tree/main/charts/ingress-nginx" rel="nofollow noreferrer">Nginx helm chart</a>.</p>
  <p>Promtail is ingesting logs fine into Loki, but I want to customise the way my logs look. Specifically I want to remove a part of the log because it creates errors when trying to parse it with either <code>logfmt</code> or <code>json</code> (<code>Error: LogfmtParserErr</code> and <code>Error: JsonParserErr</code> respectively).</p>
  <p>The logs look like this:</p>
  <pre><code>2022-02-21T13:41:53.155640208Z stdout F timestamp=2022-02-21T13:41:53+00:00 http_request_method=POST http_response_status_code=200 http_response_time=0.001 http_version=HTTP/2.0 http_request_body_bytes=0 http_request_bytes=63
  </code></pre>
  <p>and I want to remove the part where it says <code>stdout F</code> so the log will look like this:</p>
  <pre><code>2022-02-21T13:41:53.155640208Z timestamp=2022-02-21T13:41:53+00:00 http_request_method=POST http_response_status_code=200 http_response_time=0.001 http_version=HTTP/2.0 http_request_body_bytes=0 http_request_bytes=63
  </code></pre>
  <p>I have figured out that on the ingestion side it could be something with Promtail, but ist it also possible to make a LogQL query in Loki to just replace that string? And how would one set up the Promtail configuration for the wanted behaviour?</p>