-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector.toml.sample
More file actions
74 lines (62 loc) · 1.53 KB
/
vector.toml.sample
File metadata and controls
74 lines (62 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
[api]
enabled = true
[sources.docker]
type = "docker_logs"
include_containers = ["auth-service"]
exclude_containers = ["logs-collector"]
[transforms.decode_json]
type = "remap"
inputs = ["docker"]
source = '''
if is_string(.message) {
.parsed, err = parse_json(.message)
if err == null {
# Core fields
.ts, err = parse_timestamp(.parsed.timestamp, "%Y-%m-%dT%H:%M:%S%.3fZ")
.timestamp, err = if err == null {
format_timestamp(.ts, "%Y-%m-%d %H:%M:%S%.3f")
} else {
now()
}
.level = .parsed.level
.service = .parsed.service
.requestId = .parsed.requestId
.message = .parsed.message
.operation = .parsed.operation
.method = .parsed.method
# Duration and status
.durationMs, err = to_int(.parsed.durationMs)
if err != null { .durationMs = 0 }
.status, err = to_int(.parsed.status)
if err != null { .status = 0 }
# Auth fields
.email = .parsed.email
.authId = .parsed.authId
# Error fields
.error = .parsed.error
.stack = .parsed.stack
}
}
# Container metadata
.container_id = .container_id
.container_name = .container_name
# Clean up
del(.parsed)
'''
[sinks.clickhouse]
type = "clickhouse"
inputs = ["decode_json"]
endpoint = "http://clickhouse:8123"
database = "service_logs"
table = "logs"
skip_unknown_fields = true
compression = "gzip"
[sinks.clickhouse.auth]
strategy = "basic"
user = "${CLICKHOUSE_USER}"
password = "${CLICKHOUSE_PASSWORD}"
[sinks.console]
type = "console"
inputs = ["docker"]
target = "stdout"
encoding.codec = "json"