2025-03-05 10:20:02 +08:00
|
|
|
timezone = "Asia/Shanghai"
|
|
|
|
|
|
2025-03-03 18:07:42 +08:00
|
|
|
[api]
|
|
|
|
|
enabled = true
|
|
|
|
|
address = "0.0.0.0:8686"
|
|
|
|
|
|
2025-03-03 17:14:45 +08:00
|
|
|
[sources.docker]
|
|
|
|
|
type = "docker_logs"
|
|
|
|
|
include_containers = ["proxy-server-dev-service"]
|
|
|
|
|
|
|
|
|
|
[transforms.parse]
|
|
|
|
|
inputs = ["docker"]
|
2025-03-03 18:07:42 +08:00
|
|
|
type = "remap"
|
|
|
|
|
source = '''
|
|
|
|
|
. = parse_json!(.message)
|
2025-03-05 10:20:02 +08:00
|
|
|
.time, err = format_timestamp(parse_timestamp!(.time, "%+"), "%Y-%m-%dT%H:%M:%S", "Asia/Shanghai")
|
|
|
|
|
if err != null {
|
|
|
|
|
log("Unable to parse JSON: " + err, level: "error")
|
|
|
|
|
abort
|
|
|
|
|
}
|
2025-03-03 18:07:42 +08:00
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
# ===============
|
|
|
|
|
# 用户访问记录
|
|
|
|
|
# ===============
|
2025-03-03 17:14:45 +08:00
|
|
|
|
|
|
|
|
[transforms.destinations]
|
|
|
|
|
inputs = ["parse"]
|
2025-03-03 18:07:42 +08:00
|
|
|
type = "filter"
|
2025-03-03 17:14:45 +08:00
|
|
|
condition = ".msg == \"用户访问记录\""
|
|
|
|
|
|
|
|
|
|
[sinks.file_out]
|
|
|
|
|
inputs = ["destinations"]
|
2025-03-03 18:07:42 +08:00
|
|
|
type = "file"
|
2025-03-03 17:14:45 +08:00
|
|
|
path = "/temp/vector/service-destinations/%Y-%m-%d.log"
|
|
|
|
|
encoding.codec = "csv"
|
|
|
|
|
encoding.csv.fields = ["time", "uid", "user", "proxy", "node", "proto", "dest", "domain"]
|
2025-03-03 18:07:42 +08:00
|
|
|
buffer.type = "disk"
|
|
|
|
|
buffer.max_size = 268435488
|
2025-03-03 17:14:45 +08:00
|
|
|
|
2025-03-03 18:07:42 +08:00
|
|
|
# ===============
|
|
|
|
|
# errors
|
|
|
|
|
# ===============
|
2025-03-03 17:14:45 +08:00
|
|
|
|
2025-03-03 18:07:42 +08:00
|
|
|
[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
|