Promtail Restore Log Data Into Loki
server:
http_listen_port: 9080
grpc_listen_port: 0
clients:
- url: http://loki:3100/loki/api/v1/push
batchsize: 100000 # in bytes, adjust to a lower value512000
batchwait: 1s # wait time before sending batch
positions:
filename: /tmp/positions.yaml
scrape_configs:
# Scraping Docker container logs
# - job_name: docker
# docker_sd_configs:
# - host: "unix:///var/run/docker.sock" # Docker API Socket
# relabel_configs:
# - source_labels: [__meta_docker_container_name]
# target_label: container_name
# - source_labels: [__meta_docker_container_id]
# target_label: container_id
# pipeline_stages:
# - docker: {} # Optional: parses Docker logs
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/backups/**/*.log
pipeline_stages:
- json:
expressions:
log: log
stream: stream
time: time
- regex:
source: filename
expression: '.*/(?P<app_name>[^_]+)_.+\.log$'
- labels:
stream: stream
time:app: timeapp_name
- timestamp:
source: time
format: RFC3339Nano
- output:
format: json
source: log