# Pod related label missing in log file based scraping

**URL:** <https://community.grafana.com/t/pod-related-label-missing-in-log-file-based-scraping/63092>\
**Category:** Grafana Loki\
**Created:** [March 29, 2022, 5:52am UTC](https://community.grafana.com/t/pod-related-label-missing-in-log-file-based-scraping/63092 "2022-03-29T05:52:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandhraprakash](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/sandhraprakash/32/22246_2.png) [@sandhraprakash](https://community.grafana.com/u/sandhraprakash)\
**Post date:** [March 29, 2022, 5:52am UTC](https://community.grafana.com/t/pod-related-label-missing-in-log-file-based-scraping/63092/1 "2022-03-29T05:52:08Z")

</div>

I am having different services running in different pods with promtail as sidecar.  
Each service generates log files, which the sidecar promtail is aware about using static\_configs. But when it comes to the grafana, labels like pod name, namespace, container name are missing. what I would like to see is, each log line extracted from the log file also have the namespace, pod name and container name information in labels.

Config that I tried

```auto
server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: http://loki.loki.svc.cluster.local:3100/loki/api/v1/push

scrape_configs:
  - job_name: audit
    kubernetes_sd_configs:
      - role: pod
    relabel_configs:
      - action: replace
        replacement: $1
        source_labels: ['__meta_kubernetes_namespace']
        target_label: namespace
    static_configs:
      - labels:
          logType: audit
          __path__ : /var/log/audit/*log
          app: app1

```

The above config doesnt show any namespace label. What should the config look like to get namespace label properly in grafana

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [March 29, 2023, 5:53am UTC](https://community.grafana.com/t/pod-related-label-missing-in-log-file-based-scraping/63092/2 "2023-03-29T05:53:00Z")

</div>

Closed on March 29, 2023, 5:53am UTC

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
