Files
tokens-reef/deploy/monitoring/promtail/promtail-config.yml
Developer 349d783fd1 refactor: clean up project structure
- Remove old review reports (keep latest only)
- Move docs/ to deploy/docs-backup/
- Move performance-testing/ to deploy/
- Clean up test output files
- Organize root directory
2026-04-06 23:36:03 +08:00

99 lines
2.8 KiB
YAML

# =============================================================================
# Promtail 配置文件
# =============================================================================
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:
# ---------------------------------------------------------------------------
# Sub2API 应用日志
# ---------------------------------------------------------------------------
- job_name: sub2api
static_configs:
- targets:
- localhost
labels:
job: sub2api
service: sub2api
__path__: /var/log/sub2api/*.log
pipeline_stages:
- json:
expressions:
level: level
component: component
trace_id: trace_id
request_id: request_id
- labels:
level:
component:
# ---------------------------------------------------------------------------
# Docker 容器日志
# ---------------------------------------------------------------------------
- job_name: docker
static_configs:
- targets:
- localhost
labels:
job: docker
__path__: /var/lib/docker/containers/*/*.log
pipeline_stages:
- json:
expressions:
output: log
stream: stream
attrs:
- json:
source: attrs
expressions:
tag:
- regex:
source: tag
expression: (?P<container_name>(?:[^|])*[^|])
- timestamp:
source: time
format: RFC3339Nano
- labels:
stream:
container_name:
- output:
source: output
# ---------------------------------------------------------------------------
# 系统日志
# ---------------------------------------------------------------------------
- job_name: syslog
static_configs:
- targets:
- localhost
labels:
job: syslog
__path__: /var/log/syslog
# ---------------------------------------------------------------------------
# Nginx 访问日志 (如果有)
# ---------------------------------------------------------------------------
- job_name: nginx
static_configs:
- targets:
- localhost
labels:
job: nginx
__path__: /var/log/nginx/access.log
pipeline_stages:
- regex:
expression: '^(?P<remote_addr>\S+) - (?P<remote_user>\S+) \[(?P<time_local>[^\]]+)\] "(?P<request>[^"]+)" (?P<status>\d+) (?P<body_bytes_sent>\d+) "(?P<http_referer>[^"]+)" "(?P<http_user_agent>[^"]+)"'
- labels:
status:
- timestamp:
source: time_local
format: 02/Jan/2006:15:04:05 -0700