-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathfluent.conf.xray
163 lines (157 loc) · 4.61 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
<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>.+)$
</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
</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>[^\|]*)\|(?<request_content_length>[^\|]*)\|(?<response_content_length>[^\|]*)\|(?<request_duration>[^\|]*)\|(?<request_user_agent>.*)$
</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>.*)$/
</parse>
</filter>
<filter jfrog.**>
@type record_transformer
<record>
hostname "#{Socket.gethostname}"
log_source ${tag}
</record>
</filter>
###JFROG METRICS Plugin
<source>
@type jfrog_metrics
@id metrics_http_jfrt
tag jfrog.metrics.xray
interval 5s
metric_prefix 'jfrog.xray'
jpd_url "#{ENV['JF_JPD_URL']}"
username "#{ENV['JF_JPD_USER_NAME']}"
apikey "#{ENV['JF_JPD_API_KEY']}"
token "#{ENV['JF_JPD_TOKEN']}"
target_platform "ELASTIC"
</source>
########################
# ELASTIC OUTPUT METRICS
########################
<match jfrog.metrics.**>
@type elasticsearch
@id elasticsearch_metrics
host "#{ENV['ELASTIC_HOST']}"
port "#{ENV['ELASTIC_PORT']}"
user "#{ENV['ELASTIC_USER']}"
password "#{ENV['ELASTIC_PASSWORD']}"
scheme "#{ENV['ELASTIC_SCHEME']}"
ssl_verify "#{ENV['ELASTIC_SSL_VERIFY']}"
index_name unified-metrics-xray
include_tag_key true
type_name fluentd
logstash_format false
include_timestamp true
</match>
#END ELASTIC OUTPUT
########################
# ELASTIC OUTPUT LOGS
########################
<match jfrog.**>
@type elasticsearch
@id elasticsearch
host "#{ENV['ELASTIC_HOST']}"
port "#{ENV['ELASTIC_PORT']}"
user "#{ENV['ELASTIC_USER']}"
password "#{ENV['ELASTIC_PASSWORD']}"
scheme "#{ENV['ELASTIC_SCHEME']}"
ssl_verify "#{ENV['ELASTIC_SSL_VERIFY']}"
index_name unified-xray
include_tag_key true
type_name fluentd
logstash_format false
</match>
#END ELASTIC OUTPUT