Loki showing all the labels from promtail when searching from specific date onward but quick ranges do not work

Grafana v9.1.2 on windows server 2016 and Loki v2.9.1 on windows server 2008 r2

  • What are you trying to achieve? Consistent logs and dasboards

  • How are you trying to achieve it? by sending logs from promtail to loki and visualize them on grafana by consuming loki datasource

  • What happened? The issue I introduced labels by using regex on promtail yaml config but they are only showing on specific date ranges but not on all or quick ranges

  • What did you expect to happen? the labels should be there all the time

  • Can you copy/paste the configuration(s) that you are having problems with? yes indeed
    Loki Config:

auth_enabled: false

server:
http_listen_port: 3100
grpc_listen_port: 9096

common:
instance_addr: 127.0.0.1
path_prefix: /tmp/loki
storage:
filesystem:
chunks_directory: /tmp/loki/chunks
rules_directory: /tmp/loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory

query_range:
results_cache:
cache:
embedded_cache:
enabled: true
max_size_mb: 1024

schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h

ruler:
alertmanager_url: http://localhost:9093

By default, Loki will send anonymous, but uniquely-identifiable usage and configuration

analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/

Statistics help us better understand how Loki is used, and they show us performance

levels for most users. This helps us prioritize features and documentation.

For more information on what’s sent, look at

https://github.com/grafana/loki/blob/main/pkg/usagestats/stats.go

Refer to the buildReport method to see what goes into a report.

If you would like to disable reporting, uncomment the following lines:

#analytics:

reporting_enabled: false

Promtail config:

server:
http_listen_port: 9080
http_listen_address: 0.0.0.0

positions:
filename: /tmp/positions.yaml

clients:

scrape_configs:

  • job_name: iis-logs
    pipeline_stages:
    • regex:
      expression: ‘^(?P<s_port>\d+) (?P<c_ip>[^ ]+) (?P[^ ]+) (?P<cs_username>[^ ]+) (?P<cs_uri_query>[^“]) “(?P<cs_Referer>[^”])” (?P<cs_method>GET|POST|PUT|PATCH|DELETE) “(?P<cs_User_Agent>[^”])" (?P<sc_win32_status>\d+) (?P<sc_status>\d+) “(?P<X_Forwarded_For>[^”])" (?P<s_ip>[^ ]+) (?P[^ ]+) (?P[^ ]+) “(?P<cs_uri_stem>[^”])" “(?P<s_sitename>[^”])"’
    • labels:
      s_port: s_port
      c_ip: c_ip
      TimeTakenMS: TimeTakenMS
      cs_username: cs_username
      cs_uri_query: cs_uri_query
      cs_Referer: cs_Referer
      cs_method: cs_method
      cs_User_Agent: cs_User_Agent
      sc_win32_status: sc_win32_status
      sc_status: sc_status
      X_Forwarded_For: X_Forwarded_For
      s_ip: s_ip
      time: time
      date: date
      cs_uri_stem: cs_uri_stem
      s_sitename: s_sitename
      static_configs:
    • targets: [‘localhost’]
      labels:
      job: iis-logs
      path: ‘C:/inetpub/logs/AdvancedLogs/*’
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

No not an error just label are not showing

  • Did you follow any online instructions? If so, what is the URL?

No I didn’t mostly on my own.