1 # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
19 url => "${dmaap_base_url}/events/${event_topic}/${dmaap_consumer_group}/${dmaap_consumer_id}?timeout=15000"
21 Accept => "application/json"
23 topic => "${event_topic}"
24 tags => [ "dmaap_source" ]
26 notification_queue => {
28 url => "${dmaap_base_url}/events/${notification_topic}/${dmaap_consumer_group}/${dmaap_consumer_id}?timeout=15000"
30 Accept => "application/json"
32 topic => "${notification_topic}"
33 tags => [ "dmaap_source" ]
37 url => "${dmaap_base_url}/events/${request_topic}/${dmaap_consumer_group}/${dmaap_consumer_id}?timeout=15000"
39 Accept => "application/json"
41 topic => "${request_topic}"
42 tags => [ "dmaap_source" ]
47 schedule => { "every" => "1m" }
49 {{- if .Values.global.aafEnabled }}
50 cacert => "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.clamp_ca_certs_pem }}"
52 cacert => "/certs.d/aafca.pem"
59 # avoid noise if no entry in the list
60 if [message] == "[]" {
64 if [http_request_failure] or [@metadata][code] != 200 {
66 add_tag => [ "error" ]
70 if "dmaap_source" in [@metadata][request][tags] {
72 # Dmaap provides a json list, whose items are Strings containing the event
73 # provided to Dmaap, which itself is an escaped json.
75 # We first need to parse the json as we have to use the plaintext as it cannot
76 # work with list of events, then split that list into multiple string events,
77 # that we then transform into json.
91 remove_field => [ "message" ]
96 # Some timestamps are expressed as milliseconds, some are in microseconds
98 if [closedLoopAlarmStart] {
101 if event.get('closedLoopAlarmStart').to_s.to_i(10) > 9999999999999
102 event.set('closedLoopAlarmStart', event.get('closedLoopAlarmStart').to_s.to_i(10) / 1000)
104 event.set('closedLoopAlarmStart', event.get('closedLoopAlarmStart').to_s.to_i(10))
109 match => [ "closedLoopAlarmStart", UNIX_MS ]
110 target => "closedLoopAlarmStart"
114 if [closedLoopAlarmEnd] {
117 if event.get('closedLoopAlarmEnd').to_s.to_i(10) > 9999999999999
118 event.set('closedLoopAlarmEnd', event.get('closedLoopAlarmEnd').to_s.to_i(10) / 1000)
120 event.set('closedLoopAlarmEnd', event.get('closedLoopAlarmEnd').to_s.to_i(10))
125 match => [ "closedLoopAlarmEnd", UNIX_MS ]
126 target => "closedLoopAlarmEnd"
133 # Notification time are expressed under the form "yyyy-MM-dd HH:mm:ss", which
134 # is close to ISO8601, but lacks of T as spacer: "yyyy-MM-ddTHH:mm:ss"
136 if [notificationTime] {
139 "notificationTime", " ", "T"
143 match => [ "notificationTime", ISO8601 ]
144 target => "notificationTime"
150 # Renaming some fields for readability
152 if [AAI][generic-vnf.vnf-name] {
154 add_field => { "vnfName" => "%{[AAI][generic-vnf.vnf-name]}" }
157 if [AAI][generic-vnf.vnf-type] {
159 add_field => { "vnfType" => "%{[AAI][generic-vnf.vnf-type]}" }
162 if [AAI][vserver.vserver-name] {
164 add_field => { "vmName" => "%{[AAI][vserver.vserver-name]}" }
167 if [AAI][complex.city] {
169 add_field => { "locationCity" => "%{[AAI][complex.city]}" }
172 if [AAI][complex.state] {
174 add_field => { "locationState" => "%{[AAI][complex.state]}" }
180 # Adding some flags to ease aggregation
182 if [closedLoopEventStatus] =~ /(?i)ABATED/ {
184 add_field => { "flagAbated" => "1" }
187 if [notification] =~ /^.*?(?:\b|_)FINAL(?:\b|_).*?(?:\b|_)FAILURE(?:\b|_).*?$/ {
189 add_field => { "flagFinalFailure" => "1" }
194 if "error" not in [@metadata][request][tags]{
196 # Creating data for a secondary index
199 clones => [ "event-cl-aggs" ]
200 add_tag => [ "event-cl-aggs" ]
203 if "event-cl-aggs" in [@metadata][request][tags]{
205 # we only need a few fields for aggregations; remove all fields from clone except :
206 # vmName,vnfName,vnfType,requestID,closedLoopAlarmStart, closedLoopControlName,closedLoopAlarmEnd,abated,nbrDmaapevents,finalFailure
209 whitelist_names => ["^@.*$","^topic$","^type$","^tags$","^flagFinalFailure$","^flagAbated$","^locationState$","^locationCity$","^vmName$","^vnfName$","^vnfType$","^requestID$","^closedLoopAlarmStart$","^closedLoopControlName$","^closedLoopAlarmEnd$","^target$","^target_type$","^triggerSourceName$","^policyScope$","^policyName$","^policyVersion$"]
222 if "error" in [tags] {
226 {{- if .Values.global.aafEnabled }}
227 cacert => "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.clamp_ca_certs_pem }}"
229 cacert => "/clamp-cert/ca-certs.pem"
231 ssl_certificate_verification => false
232 hosts => ["${elasticsearch_base_url}"]
233 user => ["${logstash_user}"]
234 password => ["${logstash_pwd}"]
235 index => "errors-%{+YYYY.MM.DD}"
236 doc_as_upsert => true
239 } else if "event-cl-aggs" in [tags] {
243 hosts => ["${elasticsearch_base_url}"]
244 {{- if .Values.global.aafEnabled }}
245 cacert => "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.clamp_ca_certs_pem }}"
247 cacert => "/clamp-cert/ca-certs.pem"
249 ssl_certificate_verification => false
250 user => ["${logstash_user}"]
251 password => ["${logstash_pwd}"]
252 document_id => "%{requestID}"
253 index => "events-cl-%{+YYYY.MM.DD}" # creates daily indexes for control loop
254 doc_as_upsert => true
262 hosts => ["${elasticsearch_base_url}"]
263 {{- if .Values.global.aafEnabled }}
264 cacert => "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.clamp_ca_certs_pem }}"
266 cacert => "/clamp-cert/ca-certs.pem"
268 ssl_certificate_verification => false
269 user => ["${logstash_user}"]
270 password => ["${logstash_pwd}"]
271 index => "events-%{+YYYY.MM.DD}" # creates daily indexes
272 doc_as_upsert => true