forked from jfrog/log-analytics-splunk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fluent.conf.rt6
89 lines (88 loc) · 3.09 KB
/
fluent.conf.rt6
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
<source>
@type tail
@id artifactory_service_tail
path "#{ENV['ARTIFACTORY_HOME']}/logs/artifactory.log"
pos_file "#{ENV['ARTIFACTORY_HOME']}/logs/artifactory.log.pos"
tag jfrog.rt.artifactory.service
<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>
</source>
<source>
@type tail
@id artifactory_request_tail
path "#{ENV['ARTIFACTORY_HOME']}/logs/request.log"
pos_file "#{ENV['ARTIFACTORY_HOME']}/logs/request.log.pos"
tag jfrog.rt.artifactory.request
<parse>
@type regexp
expression ^(?<timestamp>[^ ]*)\|(?<trace_id>[^\|]*)\|(?<remote_address>[^\|]*)\|(?<username>[^\|]*)\|(?<request_method>[^\|]*)\|(?<request_url>[^\|]*)\|(?<return_status>[^\|]*)\|(?<response_content_length>[^\|]*)\|(?<request_content_length>[^\|]*)\|(?<request_duration>[^\|]*)\|(?<request_user_agent>.+)$
time_key timestamp
time_format %Y-%m-%dT%H:%M:%S.%LZ
</parse>
</source>
<filter jfrog.rt.artifactory.request>
@type record_transformer
enable_ruby true
<record>
repo ${record["request_url"].split('/')[3]}
image ${record["request_url"].split('/')[5]}
</record>
</filter>
<source>
@type tail
@id artifactory_access_tail
path "#{ENV['ARTIFACTORY_HOME']}/logs/access.log"
pos_file "#{ENV['ARTIFACTORY_HOME']}/logs/access.log.pos"
tag jfrog.rt.artifactory.access
<parse>
@type regexp
expression /^(?<timestamp>[^ ]*) \[(?<trace_id>[^\]]*)\] \[(?<action_response>[^\]]*)\] (?<repo_path>.*) for client : (?<username>.+)/(?<ip>.+).$/
time_key timestamp
time_format %Y-%m-%dT%H:%M:%S.%LZ
</parse>
</source>
<filter jfrog.**>
@type record_transformer
<record>
hostname "#{Socket.gethostname}"
log_source ${tag}
</record>
</filter>
<filter jfrog.rt.artifactory.request>
@type record_transformer
enable_ruby true
<record>
repo ${record["request_url"].include?("/api/docker") && !record["request_url"].include?("/api/docker/null") && !record["request_url"].include?("/api/docker/v2") ? (record["request_url"].split('/')[3]) : ("")}
image ${record["request_url"].include?("/api/docker") && !record["request_url"].include?("/api/docker/null") && !record["request_url"].include?("/api/docker/v2") ? (record["request_url"].split('/')[5]) : ("")}
</record>
</filter>
<filter jfrog.rt.artifactory.access>
@type record_transformer
enable_ruby true
<record>
impacted_artifacts ${if record['repo_path'].length > 1; "default/" + record["repo_path"].split(':')[0] + "/" + record["repo_path"].split(':')[1].rstrip ; end;}
</record>
</filter>
####################
# SPLUNK OUTPUT
####################
<match jfrog.**>
@type splunk_hec
host HEC_HOST
port HEC_PORT
token HEC_TOKEN
index jfrog_splunk
format json
sourcetype_key log_source
use_fluentd_time false
# buffered output parameter
flush_interval 10s
# ssl parameter
#use_ssl true
#ca_file /path/to/ca.pem
</match>