EC2 Labels in promtail

I am trying to get my ec2 tags to show up in loki when using promtail. I have tried various configurations and can’t seem to make it work so I figured my next best option may be coming here and explaining what I’m trying to do.

I have a cluster of instances. Each instance has 2 tags that are important to me [env, purpose]. env can be one of [dev,stg.prd] and purpose can be one of [api,ws,trn] I want to be able to add these tags along with the job name to the logs for these instances so in Grafana I can search for logs like this: {env=“stg”, purpose=“api”, job=“access_logs”} (assuming i have a job named access_logs)

I have promtail installed on each of the instances not running in a docker container. I’m not trying to do service discovery, just add the tags.

Thanks for reading!

1 Like