2 # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
21 url => "${dmaap_base_url}/events/${event_topic}/${dmaap_consumer_group}/${dmaap_consumer_id}?timeout=15000"
23 Accept => "application/json"
25 topic => "${event_topic}"
26 tags => [ "dmaap_source" ]
28 notification_queue => {
30 url => "${dmaap_base_url}/events/${notification_topic}/${dmaap_consumer_group}/${dmaap_consumer_id}?timeout=15000"
32 Accept => "application/json"
34 topic => "${notification_topic}"
35 tags => [ "dmaap_source" ]
39 url => "${dmaap_base_url}/events/${request_topic}/${dmaap_consumer_group}/${dmaap_consumer_id}?timeout=15000"
41 Accept => "application/json"
43 topic => "${request_topic}"
44 tags => [ "dmaap_source" ]
49 schedule => { "every" => "1m" }
51 {{- if .Values.global.aafEnabled }}
52 cacert => "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.clamp_ca_certs_pem }}"
54 cacert => "/certs.d/aafca.pem"
61 # avoid noise if no entry in the list
62 if [message] == "[]" {
66 if [http_request_failure] or [@metadata][code] != 200 {
68 add_tag => [ "error" ]
72 if "dmaap_source" in [@metadata][request][tags] {
74 # Dmaap provides a json list, whose items are Strings containing the event
75 # provided to Dmaap, which itself is an escaped json.
77 # We first need to parse the json as we have to use the plaintext as it cannot
78 # work with list of events, then split that list into multiple string events,
79 # that we then transform into json.
93 remove_field => [ "message" ]
98 # Some timestamps are expressed as milliseconds, some are in microseconds
100 if [closedLoopAlarmStart] {
103 if event.get('closedLoopAlarmStart').to_s.to_i(10) > 9999999999999
104 event.set('closedLoopAlarmStart', event.get('closedLoopAlarmStart').to_s.to_i(10) / 1000)
106 event.set('closedLoopAlarmStart', event.get('closedLoopAlarmStart').to_s.to_i(10))
111 match => [ "closedLoopAlarmStart", UNIX_MS ]
112 target => "closedLoopAlarmStart"
116 if [closedLoopAlarmEnd] {
119 if event.get('closedLoopAlarmEnd').to_s.to_i(10) > 9999999999999
120 event.set('closedLoopAlarmEnd', event.get('closedLoopAlarmEnd').to_s.to_i(10) / 1000)
122 event.set('closedLoopAlarmEnd', event.get('closedLoopAlarmEnd').to_s.to_i(10))
127 match => [ "closedLoopAlarmEnd", UNIX_MS ]
128 target => "closedLoopAlarmEnd"
135 # Notification time are expressed under the form "yyyy-MM-dd HH:mm:ss", which
136 # is close to ISO8601, but lacks of T as spacer: "yyyy-MM-ddTHH:mm:ss"
138 if [notificationTime] {
141 "notificationTime", " ", "T"
145 match => [ "notificationTime", ISO8601 ]
146 target => "notificationTime"
152 # Renaming some fields for readability
154 if [AAI][generic-vnf.vnf-name] {
156 add_field => { "vnfName" => "%{[AAI][generic-vnf.vnf-name]}" }
159 if [AAI][generic-vnf.vnf-type] {
161 add_field => { "vnfType" => "%{[AAI][generic-vnf.vnf-type]}" }
164 if [AAI][vserver.vserver-name] {
166 add_field => { "vmName" => "%{[AAI][vserver.vserver-name]}" }
169 if [AAI][complex.city] {
171 add_field => { "locationCity" => "%{[AAI][complex.city]}" }
174 if [AAI][complex.state] {
176 add_field => { "locationState" => "%{[AAI][complex.state]}" }
182 # Adding some flags to ease aggregation
184 if [closedLoopEventStatus] =~ /(?i)ABATED/ {
186 add_field => { "flagAbated" => "1" }
189 if [notification] =~ /^.*?(?:\b|_)FINAL(?:\b|_).*?(?:\b|_)FAILURE(?:\b|_).*?$/ {
191 add_field => { "flagFinalFailure" => "1" }
196 if "error" not in [@metadata][request][tags]{
198 # Creating data for a secondary index
201 clones => [ "event-cl-aggs" ]
202 add_tag => [ "event-cl-aggs" ]
205 if "event-cl-aggs" in [@metadata][request][tags]{
207 # we only need a few fields for aggregations; remove all fields from clone except :
208 # vmName,vnfName,vnfType,requestID,closedLoopAlarmStart, closedLoopControlName,closedLoopAlarmEnd,abated,nbrDmaapevents,finalFailure
211 whitelist_names => ["^@.*$","^topic$","^type$","^tags$","^flagFinalFailure$","^flagAbated$","^locationState$","^locationCity$","^vmName$","^vnfName$","^vnfType$","^requestID$","^closedLoopAlarmStart$","^closedLoopControlName$","^closedLoopAlarmEnd$","^target$","^target_type$","^triggerSourceName$","^policyScope$","^policyName$","^policyVersion$"]
224 if "error" in [tags] {
228 {{- if .Values.global.aafEnabled }}
229 cacert => "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.clamp_ca_certs_pem }}"
231 cacert => "/clamp-cert/ca-certs.pem"
233 ssl_certificate_verification => false
234 hosts => ["${elasticsearch_base_url}"]
235 user => ["${logstash_user}"]
236 password => ["${logstash_pwd}"]
237 index => "errors-%{+YYYY.MM.DD}"
238 doc_as_upsert => true
241 } else if "event-cl-aggs" in [tags] {
245 hosts => ["${elasticsearch_base_url}"]
246 {{- if .Values.global.aafEnabled }}
247 cacert => "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.clamp_ca_certs_pem }}"
249 cacert => "/clamp-cert/ca-certs.pem"
251 ssl_certificate_verification => false
252 user => ["${logstash_user}"]
253 password => ["${logstash_pwd}"]
254 document_id => "%{requestID}"
255 index => "events-cl-%{+YYYY.MM.DD}" # creates daily indexes for control loop
256 doc_as_upsert => true
264 hosts => ["${elasticsearch_base_url}"]
265 {{- if .Values.global.aafEnabled }}
266 cacert => "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.clamp_ca_certs_pem }}"
268 cacert => "/clamp-cert/ca-certs.pem"
270 ssl_certificate_verification => false
271 user => ["${logstash_user}"]
272 password => ["${logstash_pwd}"]
273 index => "events-%{+YYYY.MM.DD}" # creates daily indexes
274 doc_as_upsert => true