I can't seem to get this to parse any labels in a dry run (or when pushing data into Loki either).
[inspect: timestamp stage]: none ends up empty
Any idea why? The config file is properly formatted YAML. I have tried multiple versions of promtail and no success.
cat dev.log | promtail --config.file promtail-config.yml --stdin --dry-run --inspect
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: "http://loki:3100/loki/api/v1/push"
scrape_configs:
- job_name: api-ingest
pipeline_stages:
- json:
expressions:
timestamp: timestamp
message: message
app_name: app_name
level: level
app_url: app_url
- labels:
level:
app_name:
app_url:
message:
- timestamp:
source: timestamp
format: RFC3339
static_configs:
- targets:
- localhost
labels:
job: "api-ingest"
environment: "prod"
__path__: /mylogfile.log
Logfile:
{"timestamp":"2024-02-21T14:06:37-06:00","app_name":"m-app-production","app_url":"http://192.168.1.100:3001","level":"INFO","message":"Cron is disabled: not scheduling jobs"},
{"timestamp":"2024-02-21T14:06:38-06:00","app_name":"m-app-production","app_url":"http://192.168.1.100:3001","level":"INFO","message":"connecting to Redis..."},
{"timestamp":"2024-02-21T14:06:38-06:00","app_name":"m-app-production","app_url":"http://192.168.1.100:3001","level":"INFO","message":"Redis connected"},
Clients configured:
----------------------
url: http://loki:3100/loki/api/v1/push
batchwait: 1s
batchsize: 1048576
follow_redirects: true
enable_http2: true
backoff_config:
min_period: 500ms
max_period: 5m0s
max_retries: 10
timeout: 10s
tenant_id: ""
drop_rate_limited_batches: false
stream_lag_labels: ""
[inspect: timestamp stage]: none
2024-02-22T11:04:20.083141803-0600 {job="api-ingest"} {"timestamp":"2024-02-21T14:06:37-06:00","app_name":"m-app-production","app_url":"http://192.168.1.100:3001","level":"INFO","message":"Cron is disabled: not scheduling jobs"},
[inspect: timestamp stage]: none
2024-02-22T11:04:20.083143146-0600 {job="api-ingest"} {"timestamp":"2024-02-21T14:06:38-06:00","app_name":"m-app-production","app_url":"http://192.168.1.100:3001","level":"INFO","message":"connecting to Redis..."},
[inspect: timestamp stage]: none
2024-02-22T11:04:20.08314537-0600 {job="api-ingest"} {"timestamp":"2024-02-21T14:06:38-06:00","app_name":"m-app-production","app_url":"http://192.168.1.100:3001","level":"INFO","message":"Redis connected"},