blob: 7d1e5c67a97f16e6f5854057ab735dfe28a99e98 [file] [log] [blame]
Dmitry Kalashnik541ffb42019-04-16 15:26:21 +04001parameters:
2 fluentd:
3 agent:
4 config:
5 label:
6 notification_messages:
7 filter:
8 parse_publuisher_host:
9 tag: notification
10 type: parser
11 key_name: publisher_id
12 reserve_data: true
13 parser:
14 type: regexp
15 format: (?<publisher>\w+).(?<hostname>\w+)
16 save_hostname:
17 tag: notification
18 require:
19 - parse_publuisher_host
20 type: record_transformer
21 enable_ruby: true
22 record:
23 - name: Hostname
24 value: ${fluentd:dollar}{ record["hostname"] }
25 parse_source:
26 tag: notification
27 require:
28 - save_hostname
29 type: parser
30 key_name: event_type
31 reserve_data: true
32 parser:
33 type: regexp
34 format: (?<event_type_logger>\w+).+
35 map_logger:
36 tag: notification
37 require:
38 - parse_source
39 type: record_transformer
40 enable_ruby: true
41 remove_keys: event_type_logger
42 record:
43 - name: Logger
44 value: ${fluentd:dollar}{ {'volume'=>'cinder', 'snapshot'=>'cinder', 'image'=>'glance', 'orchestration'=>'heat', 'identity'=>'keystone', 'compute'=>'nova', 'compute_task'=>'nova', 'scheduler'=>'nova', 'keypair'=>'nova', 'floatingip' =>'neutron', 'security_group' =>'neutron', 'security_group_rule' =>'neutron', 'network' =>'neutron', 'port' =>'neutron', 'router' =>'neutron', 'subnet' =>'neutron', 'sahara' =>'sahara'}[record["event_type_logger"]] }
45 get_payload_values:
46 tag: notification
47 require:
48 - map_logger
49 type: record_transformer
50 enable_ruby: true
51 record:
52 - name: Timestamp
53 value: ${fluentd:dollar}{ DateTime.strptime(record['timestamp'], '%Y-%m-%d %H:%M:%S.%N').strftime('%Y-%m-%dT%H:%M:%S.%3NZ') }
54 - name: severity_label
55 value: ${fluentd:dollar}{ record["priority"] }
56 - name: Severity
57 value: ${fluentd:dollar}{ {'TRACE'=>7,'DEBUG'=>7,'INFO'=>6,'AUDIT'=>6,'WARNING'=>4,'ERROR'=>3,'CRITICAL'=>2}[record['priority']].to_i }
58 - name: Hostname
59 value: '${fluentd:dollar}{ record["payload"].has_key?("host") ? record["payload"]["host"] : record["Hostname"] }'
60 - name: environment_label
61 value: ${_param:cluster_domain}
62
63 - name: tenant_id
64 value: ${fluentd:dollar}{ record.dig("payload", "tenant_id") }
65 - name: user_id
66 value: ${fluentd:dollar}{ record.dig("payload", "user_id") }
67 - name: display_name
68 value: ${fluentd:dollar}{ record.dig("payload", "display_name") }
69 - name: vcpus
70 value: ${fluentd:dollar}{ record.dig("payload", "vcpus") }
71 - name: availability_zone
72 value: ${fluentd:dollar}{ record.dig("payload", "availability_zone") }
73 - name: instance_id
74 value: ${fluentd:dollar}{ record.dig("payload", "instance_id") }
75 - name: instance_type
76 value: ${fluentd:dollar}{ record.dig("payload", "instance_type") }
77 - name: image_name
78 value: ${fluentd:dollar}{ record.dig("payload", "image_name") }
79 - name: memory_mb
80 value: ${fluentd:dollar}{ record.dig("payload", "memory_mb") }
81 - name: disk_gb
82 value: ${fluentd:dollar}{ record.dig("payload", "disk_gb") }
83 - name: state
84 value: ${fluentd:dollar}{ record.dig("payload", "state") }
85 - name: old_state
86 value: ${fluentd:dollar}{ record.dig("payload", "old_state") }
87 - name: old_task_state
88 value: ${fluentd:dollar}{ record.dig("payload", "old_task_state") }
89 - name: new_task_state
90 value: ${fluentd:dollar}{ record.dig("payload", "new_task_state") }
91 - name: network_id
92 value: ${fluentd:dollar}{ record.dig("payload", "network_id") }
93 - name: subnet_id
94 value: ${fluentd:dollar}{ record.dig("payload", "subnet_id") }
95 - name: port_id
96 value: ${fluentd:dollar}{ record.dig("payload", "port_id") }
97 - name: volume_id
98 value: ${fluentd:dollar}{ record.dig("payload", "volume_id") }
99 - name: size
100 value: ${fluentd:dollar}{ record.dig("payload", "size") }
101 - name: status
102 value: ${fluentd:dollar}{ record.dig("payload", "status") }
103 - name: replication_status
104 value: ${fluentd:dollar}{ record.dig("payload", "replication_status") }
105 pack_payload_to_json:
106 tag: notification
107 require:
108 - get_payload_values
109 type: record_transformer
110 enable_ruby: true
111 remove_keys: '["timestamp", "publisher_id", "priority", "notification_type", "payload"]'
112 record:
113 - name: Payload
114 value: ${fluentd:dollar}{ record["payload"].to_json }
115 match:
116 notifications_output:
117 tag: notification
118 type: elasticsearch
Dmitry Kalashnik4ae03de2019-05-23 16:47:18 +0400119 host: ${_param:fluentd_elasticsearch_host}
120 port: ${_param:fluentd_elasticsearch_port}
121 scheme: ${_param:fluentd_elasticsearch_scheme}
Dmitry Kalashnik541ffb42019-04-16 15:26:21 +0400122 es_index_name: notification
123 tag_key: Type