-
Notifications
You must be signed in to change notification settings - Fork 0
/
fluent.conf
92 lines (81 loc) · 1.98 KB
/
fluent.conf
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
########## input ##########
## system log from systemd
<source>
@type systemd
tag dtdream.system.systemd
path /fluentd/log/journal
filters [{ "_SYSTEMD_UNIT": "docker.service" }, { "_SYSTEMD_UNIT": "kube-proxy.service" }, { "_SYSTEMD_UNIT": "kubelet.service" }, { "_SYSTEMD_UNIT": "flanneld.service" }]
read_from_head true
<storage>
@type local
persistent true
path /fluentd/log/journal/log.pos
</storage>
<entry>
field_map {"MESSAGE": "message", "_HOSTNAME": "host_name", "_SYSTEMD_UNIT": "service_name"}
fields_strip_underscores true
fields_lowercase true
</entry>
</source>
## system container log from /var/log/containers/*.log
<source>
@type tail
path /fluentd/log/containers/*.log
pos_file /fluentd/log/containers/log.pos
read_from_head true
refresh_interval 5
tag dtdream.system.containers.*
format none
</source>
### app log from log-driver syslog
<source>
@type syslog
tag dtdream.app
protocol_type udp
port 24224
format /^(?<logtime>[^\]]*) (?<host>[^\]]*) (docker/k8s_)(?<containername>[^.]*)([^_]*)_(?<podname>[^_]*)_(?<namespace>[^_]*)([\s\S]*)\]:(?<message>[\s\S]*)$/
time_format %Y-%m-%dT%H:%M:%SZ
</source>
## app log filter
<filter dtdream.app.**>
@type record_transformer
<record>
tag ${tag}
</record>
</filter>
## system log filter
<filter dtdream.system.containers.**>
@type record_transformer
<record>
service_name ${tag_parts[6]}
host_name "#{Socket.gethostname}"
log_time ${time}
</record>
</filter>
<filter dtdream.system.systemd>
@type record_transformer
<record>
log_time ${time}
</record>
</filter>
########## output ##########
## app log output to redis
<match dtdream.app.**>
@type redis_store
host 127.0.0.1
port 6379
db 0
timeout 5.0
key log_fluentd_redis_app
store_type list
</match>
## system log output to redis
<match dtdream.system.**>
@type redis_store
host 127.0.0.1
port 6379
db 0
timeout 5.0
key log_fluentd_redis_system
store_type list
</match>