完善用户访问记录和错误日志处理

This commit is contained in:
2025-03-03 18:07:42 +08:00
parent 4b3cb8e354
commit 3d0b27f2e7

View File

@@ -1,28 +1,49 @@
[api]
enabled = true
address = "0.0.0.0:8686"
[sources.docker]
type = "docker_logs"
include_containers = ["proxy-server-dev-service"]
[transforms.parse]
type = "remap"
inputs = ["docker"]
source = ". = parse_json!(.message)"
type = "remap"
source = '''
. = parse_json!(.message)
'''
# ===============
# 用户访问记录
# ===============
[transforms.destinations]
type = "filter"
inputs = ["parse"]
type = "filter"
condition = ".msg == \"用户访问记录\""
[sinks.file_out]
type = "file"
inputs = ["destinations"]
type = "file"
path = "/temp/vector/service-destinations/%Y-%m-%d.log"
encoding.codec = "csv"
encoding.csv.fields = ["time", "uid", "user", "proxy", "node", "proto", "dest", "domain"]
buffer.type = "disk"
buffer.max_size = 268435488
[sinks.file_out.buffer]
type = "disk"
max_size = 268435488
# ===============
# errors
# ===============
[api]
enabled = true
address = "0.0.0.0:8686"
[transforms.errors]
inputs = ["parse"]
type = "filter"
condition = ".level == \"ERROR\""
[sinks.file_errors]
inputs = ["errors"]
type = "file"
path = "/temp/vector/service-errors/%Y-%m-%d.log"
encoding.codec = "json"
buffer.type = "disk"
buffer.max_size = 268435488