<p>I've been making some tests with a Kubernetes cluster and I installed the loki-promtail stack by means of the helm loki/loki-stack chart.</p>
<p>The default configuration works fine, but now I would like to add some custom behaviour to the standard promtail config.</p>
<p>According to the <a href="https://grafana.com/docs/loki/latest/clients/promtail/pipelines/" rel="nofollow noreferrer">Promtail documentation</a> I tried to customise the values.xml in this way:</p>
<pre><code>promtail:        
   extraScrapeConfigs:
   - job_name: dlq-reader
     kubernetes_sd_configs:
     - role: pod
     pipeline_stages:
     - template:
         source: new_key
         template: 'test'
     - output: 
         source: new_key
</code></pre>
<p>The expected behaviour is that every log line is replaced by the static text &quot;test&quot; (of course this is a silly test just to get familiar with this environment).</p>
<p>What I see is that this configuration is correctly applied to the loki config-map but without any effect: the log lines looks exactly as if this additional configuration wasn't there.</p>
<p>The loki-stack chart version is 0.39.0 which installs loki 1.5.0.</p>
<p>I cannot see any error in the loki/promtails logs... Any suggestion?</p>

Marco Barbi
<p>I finally discovered the issue then I post what I found in case this might help anyone else with the same issue.</p>
<p>In order to modify the log text or to add custom labels, the correct values.yaml section to provide is <code>pipelineStages</code> instead of <code>extraScrapeConfigs</code>. Then, the previous snippet must be changed in the following way:</p>
<pre><code> promtail:        
   pipelineStages:
   - docker: {}
   - match:
       selector: '{container=&quot;dlq-reader&quot;}'
       stages:
       - template:
           source: new_key
           template: 'test'
       - output: 
           source: new_key
</code></pre>
