其他
loki.yaml
auth_enabled: false
server:
http_listen_port: 3100
ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s
schema_config:
configs:
- from: 2020-05-15
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
boltdb_shipper:
active_index_directory: /data/loki/data/index
cache_location: /data/loki/data/index/cache
shared_store: filesystem
filesystem:
directory: /data/loki/data/chunks
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 720h
per_stream_rate_limit: "20MB"
ingestion_rate_strategy: local
max_streams_per_user: 0
ingestion_rate_mb: 1024
ingestion_burst_size_mb: 1024
retention_period: 720h
compactor:
working_directory: /data/loki/data/compactor
shared_store: filesystem
compaction_interval: 10m
retention_enabled: true
promtail-config.yaml
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://192.168.10.206:3100/loki/api/v1/push
scrape_configs:
- job_name: cdp-file-web
static_configs:
- targets:
- 192.168.10.17
labels:
job: cdp-file-web
env: prd
ip: 192.168.10.17
__path__: /data/logs/cdp-file-web/cdp-file-web.log
pipeline_stages:
- match:
selector: '{job="cdp-file-web"}'
stages:
- multiline:
firstline: '^\[' # 匹配日志的正则表达式
max_wait_time: 3s
- regex:
expression: '^\[.+] \[(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\]\['
- labels:
time:
- timestamp:
format: "2006-01-02 15:04:05"
source: time
location: Asia/Shanghai