forked from jfrog/log-analytics-prometheus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fluent.conf.xray
183 lines (173 loc) · 4.57 KB
/
fluent.conf.xray
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
## Prometheus Input Plugin Configuration
# input plugin that exports metrics
<source>
@type prometheus
</source>
<source>
@type monitor_agent
</source>
<source>
@type forward
</source>
# input plugin that collects metrics from MonitorAgent
<source>
@type prometheus_monitor
<labels>
host ${hostname}
</labels>
</source>
# input plugin that collects metrics for output plugin
<source>
@type prometheus_output_monitor
<labels>
host ${hostname}
</labels>
</source>
# input plugin that collects metrics for in_tail plugin
<source>
@type prometheus_tail_monitor
<labels>
host ${hostname}
</labels>
</source>
<source>
@type tail
@id xray_server_tail
path "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/xray-server-service.log"
pos_file "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/xray-server-service.log.pos"
tag jfrog.xray.server.service
<parse>
@type none
</parse>
</source>
<source>
@type tail
@id xray_persist_tail
path "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/xray-persist-service.log"
pos_file "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/xray-persist-service.log.pos"
tag jfrog.xray.persist.service
<parse>
@type none
</parse>
</source>
<source>
@type tail
@id xray_indexer_tail
path "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/xray-indexer-service.log"
pos_file "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/xray-indexer-service.log.pos"
tag jfrog.xray.indexer.service
<parse>
@type none
</parse>
</source>
<source>
@type tail
@id xray_analysis_tail
path "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/xray-analysis-service.log"
pos_file "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/xray-analysis-service.log.pos"
tag jfrog.xray.analysis.service
<parse>
@type none
</parse>
</source>
<source>
@type tail
@id xray_router_tail
path "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/router-service.log"
pos_file "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/router-service.log.pos"
tag jfrog.xray.router.service
<parse>
@type none
</parse>
</source>
<source>
@type tail
@id xray_router_traefik_tail
path "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/router-traefik.log"
pos_file "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/router-traefik.log.pos"
tag jfrog.xray.router.traefik
<parse>
@type regexp
expression ^(?<timestamp>[^ ]*) \[(?<service_type>[^\]]*)\] \[(?<log_level>[^\]]*)\] \[(?<trace_id>[^\]]*)\] \[(?<class_line_number>.*)\] \[(?<thread>.*)\] - (?<message>.+)$
time_key timestamp
time_format %Y-%m-%dT%H:%M:%S.%LZ
</parse>
</source>
<source>
@type tail
@id xray_router_request_tail
path "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/router-request.log"
pos_file "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/router-request.log.pos"
tag jfrog.xray.router.request
<parse>
@type json
time_key time
time_format %Y-%m-%dT%H:%M:%SZ
</parse>
</source>
<source>
@type tail
@id xray_request_tail
path "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/xray-request.log"
pos_file "#{ENV['JF_PRODUCT_DATA_INTERNAL']}/log/xray-request.log.pos"
tag jfrog.xray.xray.request
<parse>
@type regexp
expression ^(?<timestamp>[^ ]*)\|(?<trace_id>[^ ]*)\|(?<remote_address>.+)\|(?<username>[^\|]*)\|(?<request_method>[^\|]*)\|(?<request_url>[^\|]*)\|(?<return_status>[^\|]*)\|(?<response_content_length>[^\|]*)\|(?<request_duration>.*)$
time_key timestamp
time_format %Y-%m-%dT%H:%M:%S.%LZ
</parse>
</source>
# STRIP COLOR CODES FROM SERVICE LOGS
<filter jfrog.xray.**.service>
@type record_transformer
enable_ruby true
<record>
message ${record["message"].gsub(/\e\[([;\d]+)?m/, '')}
</record>
</filter>
# FIELD EXTRACT SERVICE LOG
<filter jfrog.xray.**.service>
@type parser
key_name message
<parse>
@type multiline
format_firstline /\d{4}-\d{1,2}-\d{1,2}/
format1 /^(?<timestamp>[^ ]*) \[(?<service_type>[^\]]*)\] \[(?<log_level>[^\]]*)\] \[(?<trace_id>[^\]]*)\] \[(?<class_line_number>.*)\] \[(?<thread>.*)\] (?<message>.*)$/
time_key timestamp
time_format %Y-%m-%dT%H:%M:%S.%LZ
</parse>
</filter>
<filter jfrog.**>
@type record_transformer
<record>
log_source ${tag}
</record>
</filter>
<filter jfrog.xray.xray.request>
@type prometheus
<metric>
name jfrog_xray_req
type counter
desc xray requests
<labels>
host ${hostname}
remote_address ${remote_address}
request_url ${request_url}
return_status ${return_status}
method ${request_method}
</labels>
</metric>
</filter>
<filter jfrog.xray.**.service>
@type prometheus
<metric>
name jfrog_xray_log_level
type counter
desc xray log_levels
<labels>
host ${hostname}
log_level ${log_level}
</labels>
</metric>
</filter>