forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfluentd.conf
More file actions
94 lines (86 loc) 路 2.05 KB
/
Copy pathfluentd.conf
File metadata and controls
94 lines (86 loc) 路 2.05 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Fluentd configuration for GistPin log aggregation
# Input: collect logs from all containers
<source>
@type tail
path /var/log/containers/*.log
pos_file /var/log/fluentd-containers.log.pos
tag kubernetes.*
read_from_head true
<parse>
@type json
time_format %Y-%m-%dT%H:%M:%S.%NZ
</parse>
</source>
# Input: system logs
<source>
@type tail
path /var/log/syslog
pos_file /var/log/fluentd-syslog.pos
tag system.syslog
<parse>
@type syslog
</parse>
</source>
# Filter: parse Kubernetes metadata
<filter kubernetes.**>
@type kubernetes_metadata
@id filter_kube_metadata
</filter>
# Filter: parse GistPin backend JSON logs
<filter kubernetes.**gistpin-backend**>
@type parser
key_name log
reserve_data true
<parse>
@type json
</parse>
</filter>
# Filter: enrich logs with environment info
<filter **>
@type record_transformer
<record>
environment "#{ENV['ENVIRONMENT'] || 'production'}"
cluster "#{ENV['CLUSTER_NAME'] || 'gistpin-cluster'}"
hostname "#{Socket.gethostname}"
</record>
</filter>
# Filter: drop health check noise
<filter kubernetes.**>
@type grep
<exclude>
key $.request_path
pattern ^/health
</exclude>
</filter>
# Output: Elasticsearch for search/analysis
<match kubernetes.**>
@type elasticsearch
host "#{ENV['ELASTICSEARCH_HOST'] || 'elasticsearch'}"
port "#{ENV['ELASTICSEARCH_PORT'] || 9200}"
logstash_format true
logstash_prefix gistpin
include_tag_key true
tag_key @log_name
flush_interval 5s
<buffer>
@type file
path /var/log/fluentd-buffers/kubernetes.system.buffer
flush_mode interval
retry_type exponential_backoff
flush_interval 5s
retry_forever false
retry_max_interval 30
chunk_limit_size 2M
queue_limit_length 8
overflow_action block
</buffer>
</match>
# Output: system logs to Elasticsearch
<match system.**>
@type elasticsearch
host "#{ENV['ELASTICSEARCH_HOST'] || 'elasticsearch'}"
port "#{ENV['ELASTICSEARCH_PORT'] || 9200}"
logstash_format true
logstash_prefix gistpin-system
flush_interval 10s
</match>