Fluentd logging for Jenkins
Related: PROD-26813
Change-Id: I3ec9d7e7394993baa35b0cdd7f65a678136702be
diff --git a/jenkins/meta/fluentd.yml b/jenkins/meta/fluentd.yml
new file mode 100644
index 0000000..cbbe3d8
--- /dev/null
+++ b/jenkins/meta/fluentd.yml
@@ -0,0 +1,48 @@
+{%- if pillar.get('fluentd', {}).get('agent', {}).get('enabled', False) %}
+{%- set positiondb = pillar.fluentd.agent.dir.positiondb %}
+agent:
+ config:
+ label:
+ forward_input:
+ input:
+ generic_forward_input:
+ type: forward
+ bind: 0.0.0.0
+ port: 24224
+ match:
+ route_jenkins:
+ tag: jenkins.**
+ type: relabel
+ label: jenkins
+ jenkins:
+ input:
+ jenkins_in_tail:
+ type: tail
+ path: /var/log/jenkins/jenkins.log
+ tag: jenkins
+ pos_file: {{ positiondb }}/jenkins.pos
+ parser:
+ type: regexp
+ time_key: Timestamp
+ time_format: '%b %d, %Y %l:%M:%S %p'
+ keep_time_key: false
+ #Regex parsing example: https://regex101.com/r/0XNRey/4
+ format: '/(?<Timestamp>^\S{3}\s\d{2},\s\d{4}\s\d{1,2}:\d{1,2}:\d{1,2}\s\S{2})\s(?<level>\S+)\s(?<class>\S+)\s(?<method>\S*)\n(?<message>(.|\n)+?(?=^\S{3}\s\d{2}|\Z))/'
+ filter:
+ match_severity:
+ type: record_transformer
+ tag: jenkins.**
+ enable_ruby: true
+ record:
+ - name: Severity
+ value: ${ {'INFO'=>6,'WARNING'=>4,'ERROR'=>3,'SEVERE'=>2}[record['level']].to_i }
+ - name: severity_label
+ value: ${ record['level'] }
+ - name: programname
+ value: jenkins
+ match:
+ push_to_default:
+ tag: jenkins.**
+ type: relabel
+ label: default_output
+{%- endif %}
\ No newline at end of file
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 0e33c9e..9fe775d 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -16,5 +16,7 @@
grafana:
enabled: true
prometheus:
- enabled: true
+ enabled: true
+ fluentd:
+ enabled: true