Promtail parse json to make labels

73 Views Asked by At

I have the following example json log line which I need to make a label from the ChannelName field:

{
    "Channel status update": {
        "ChannelName": "Watcher",
        "Status": 3
    }
}

Using the promtail helm chart I have the following but I can't get it working correctly:

  promtail:
    config:
      snippets:
        pipelineStages:
        - json:
            expressions:
              '"Channel status update"':
        - json:
            expressions:
              channelName: ChannelName
            source: '"Channel status update"'
        - labels:
            channelName:
    enabled: true

This doesn't appear to make any new labels visable in loki/grafana and seems to break the | json parser. What am I doing wrong?

0

There are 0 best solutions below