title: How to extract log level using prom tail scrape_configs
body: <p>I have multiple pods in cluster and Promtail is configured as DaemonSet to pump logs to Loki. but not sure how to create extra label for log level from specific pod logs to query in grafana.</p>
  <p>Logs from pods:</p>
  <pre><code>[2021-12-14 11:11:11] INFO forcetask[id=pod-0] message2
  [2021-12-14 11:11:11] INFO forcetask[id=pod-0] message1
  </code></pre>
  <p>but output when query {app=&quot;loki&quot;} in Grafana</p>
  <pre><code>{log=&quot;[2021-12-14 11:11:11] INFO forcetask[id=pod-0] message2&quot;, stream=&quot;stdout&quot;, timestamp =&quot;...&quot;}
  {log=&quot;[2021-12-14 11:11:11] ERROR forcetask[id=pod-0] Error1&quot;, stream=&quot;stderr&quot;, timestamp=&quot;...&quot;}
  </code></pre>
  <p>I have configured scrape_congs on Promtail as below but no luck. Can someone please point me what am I missing here?</p>
  <pre><code>scrape_configs:
  - job_name: my-custom-labels
    pipeline_stages:
    - docke: {}
    - json:
        log: log
        stream: stream
        timestamp: timestamp
    - labels: 
         log:
    - match:
        selector: '{app=&quot;loki&quot;}'.    -- this is one of the labels of Loki instance 
        stages:
        - regex: 
            expression: '\\[(?P&lt;timestamp&gt;\\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2})\\]\\s(?P&lt;level&gt;\\w+)\\s(?P&lt;message&gt;.*)'
        - labels:
            level:
        - timestamp:
            format: RFC3339Nano
            source: timestamp
  </code></pre>