Add fluentd libvirt-exporter label

Also remove parsing sf-notifier logs file as
Docker is responsible for sf-notifier logs.

Change-Id: Id809b534239f818ca3660340d76345f4c10c7ac8
Related-bug: PROD-26897 (PROD:26897)
Related-bug: PROD-27026 (PROD:27026)
diff --git a/metadata/service/exporters/libvirt.yml b/metadata/service/exporters/libvirt.yml
index 2c910bb..e76a788 100644
--- a/metadata/service/exporters/libvirt.yml
+++ b/metadata/service/exporters/libvirt.yml
@@ -1,5 +1,7 @@
 applications:
   - prometheus
+classes:
+ - service.prometheus.support
 parameters:
   _param:
     prometheus_exporter_libvirt_port: 9177
diff --git a/prometheus/meta/fluentd.yml b/prometheus/meta/fluentd.yml
index 3720b65..ee543bb 100644
--- a/prometheus/meta/fluentd.yml
+++ b/prometheus/meta/fluentd.yml
@@ -1,46 +1,34 @@
 {%- if pillar.get('fluentd', {}).get('agent', {}).get('enabled', False) %}
-{% from "prometheus/map.jinja" import sf_notifier with context %}
-{%- if sf_notifier.get('enabled', False) %}
+  {%- if pillar.get('prometheus', {}).get('exporters', {}).libvirt is defined %}
+    {%- if grains.get('init') == 'systemd' %}
 agent:
   config:
     label:
-      sfnotifier:
-        input:
-          tail_sfnotifier:
-            type: tail
-            tag: sfnotifier.log
-            path: {{ sf_notifier.dir.logs }}/sf-notifier.log
-            pos_file: {{ pillar.fluentd.agent.dir.positiondb }}/sfnotifier.pos
-            parser:
-              type: multi_format
-              patterns:
-                # sfnotifier log format: https://regex101.com/r/JsYcJU/1
-                - type: regexp
-                  time_key: Timestamp
-                  time_format: '%F %H:%M:%S'
-                  keep_time_key: false
-                  format: '/^\[(?<Timestamp>.*)\] (?<Severity>.*?) in (?<Module>.*?)\: (?<Payload>.+)$/'
-                # http log format: https://regex101.com/r/8i6u1v/2
-                - type: regexp
-                  time_key: Timestamp
-                  time_format: '%d/%b/%Y %H:%M:%S'
-                  keep_time_key: false
-                  format: '/^(?<http_client_ip_address>[^ ]*) - - \[(?<Timestamp>.*)\] "(?<http_method>\S+) (?<http_url>[^ ]*) \S*" (?<http_status>[^ ]*) -$/'
+      libvirt_exporter:
         filter:
-          sfnotifier_record:
+          enrich:
+            tag: 'libvirt-exporter.**'
             type: record_transformer
-            tag: sfnotifier.log
             enable_ruby: true
-            remove_keys: priority
             record:
-              - name: service
-                value: sfnotifier
+              - name: programname
+                value: libvirt-exp
               - name: severity_label
-                value: '${ {"TRACE"=>8,"DEBUG"=>7,"INFO"=>6,"NOTICE"=>5,"WARNING"=>4,"ERROR"=>3,"CRITICAL"=>2,"ALERT"=>1,"EMERGENCY"=>0}.fetch(record["Severity"].to_i, 6) }'
+                value: ${ if record["Payload"].downcase.include? "error"; "ERROR"; else; "INFO"; end }
+          add_severity:
+            require:
+              - enrich
+            tag: 'libvirt-exporter.**'
+            type: record_transformer
+            enable_ruby: true
+            record:
+              - name: Severity
+                value: '${ { 8=>"TRACE",7=>"DEBUG",6=>"INFO",5=>"NOTICE",4=>"WARNING",3=>"ERROR",2=>"CRITICAL",1=>"ALERT",0=>"EMERGENCY" }.key(record["severity_label"]) }'
         match:
           push_to_default:
-            tag: sfnotifier.**
+            tag: 'libvirt-exporter.**'
             type: relabel
             label: default_output
-{%- endif %}
-{%- endif %}
+    {%- endif %}
+  {%- endif %}
+{%- endif %}
\ No newline at end of file