summaryrefslogtreecommitdiffstats
path: root/feature-mdc-filters/src/main/feature
diff options
context:
space:
mode:
authorDaniel Cruz <dc443y@att.com>2019-03-22 08:33:29 -0500
committerDaniel Cruz <dc443y@att.com>2019-03-25 09:11:29 -0500
commit89d3441bb04047d63ff8f4f586773d7c287e1deb (patch)
treef61cce38bf849e6ba71aeaf4b83db6999cd46162 /feature-mdc-filters/src/main/feature
parentd0715ca90465d0f7b3d090234f6b0098194f0101 (diff)
Add MDC Topic Filtering
A feature to provide configurable properties for network topics to extrac fields from JSON strings and place them in a mapped diagnostic context. Issue-ID: POLICY-1499 Change-Id: Icfca0be3b263ccf1612b79ed617e2b1ffb0317e6 Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'feature-mdc-filters/src/main/feature')
-rwxr-xr-xfeature-mdc-filters/src/main/feature/config/feature-mdc-filters.properties54
-rwxr-xr-xfeature-mdc-filters/src/main/feature/install/disable32
-rwxr-xr-xfeature-mdc-filters/src/main/feature/install/enable32
3 files changed, 118 insertions, 0 deletions
diff --git a/feature-mdc-filters/src/main/feature/config/feature-mdc-filters.properties b/feature-mdc-filters/src/main/feature/config/feature-mdc-filters.properties
new file mode 100755
index 00000000..0a53a9f5
--- /dev/null
+++ b/feature-mdc-filters/src/main/feature/config/feature-mdc-filters.properties
@@ -0,0 +1,54 @@
+###
+# ============LICENSE_START=======================================================
+# feature-mdc-filters
+# ================================================================================
+# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+# The properties keys follow the controller topic configurations followed by a
+# a new topic property, 'mdcFilters'.
+#<protocol>.<type>.topics.<topic-name>.mdcFilters
+
+# The value of the property is broken down to the MDC key name to be used by the
+# feature followed by the path(s) to the desired field's value.
+#dmaap.sink.topics.example.mdcFilters=sampleKey=$.path.to.sample.key
+
+# The path always begins with '$' as this signifies the root of the JSON document.
+# The underlying library used is Jayway JsonPath. The library's query syntax is
+# supported for searching a JSON document. The query syntax and some examples
+# can be found at: https://github.com/json-path/JsonPath
+
+# Multiple fields can be found for a given JSON document by a comma separated list
+# of <mdcKey,jsonPath> pairs.
+#dmaap.sink.topics.example.mdcFilters=field1=$.field1,field2=$.field2
+
+# If a given topic supports multiple message types that have fields with the same
+# name, a '|' separated list can define multiple paths to a field. The feature
+# will loop through each path until it finds a match and returns it.
+#dmaap.sink.topics.example.mdcFilters=field1=$.field1|$.body.field1
+
+# dmaap source filters
+dmaap.source.topics.PDPD-CONFIGURATION.mdcFilters=requestID=$.requestID
+dmaap.source.topics.DCAE_TOPIC.mdcFilters=requestID=$.requestID
+dmaap.source.topics.APPC-CL.mdcFilters=requestID=$.CommonHeader.RequestID
+dmaap.source.topics.APPC-LCM-WRITE.mdcFilters=requestID=$.body.output.common-header.request-id
+dmaap.source.topics.SDNR-CL-RSP.mdcFilters=requestID=$.body.CommonHeader.RequestID
+
+# dmaap sink filters
+dmaap.sink.topics.POLICY-CL-MGT.mdcFilters=requestID=$.requestID
+dmaap.sink.topics.APPC-CL.mdcFilters=requestID=$.CommonHeader.RequestID
+dmaap.sink.topics.APPC-LCM-READ.mdcFilters=requestID=$.body.input.common-header.request-id
+dmaap.sink.topics.SDNR-CL.mdcFilters=requestID=$.body.CommonHeader.RequestID
diff --git a/feature-mdc-filters/src/main/feature/install/disable b/feature-mdc-filters/src/main/feature/install/disable
new file mode 100755
index 00000000..25d57374
--- /dev/null
+++ b/feature-mdc-filters/src/main/feature/install/disable
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# feature-mdc-filters
+# ================================================================================
+# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+##
+
+if [[ "${DEBUG}" == "y" ]]; then
+ set -x
+fi
+
+CONFIG_DIR="${POLICY_HOME}"/config
+for mainConfig in ${CONFIG_DIR}/logback.xml ${CONFIG_DIR}/logback-eelf.xml; do
+ if [ -e "${mainConfig}" ]; then
+ sed -i --follow-symlinks 's/${abstractNetworkPattern}/${networkPattern}/' "${mainConfig}"
+ fi
+done
diff --git a/feature-mdc-filters/src/main/feature/install/enable b/feature-mdc-filters/src/main/feature/install/enable
new file mode 100755
index 00000000..57c7cc4a
--- /dev/null
+++ b/feature-mdc-filters/src/main/feature/install/enable
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# feature-mdc-filters
+# ================================================================================
+# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+##
+
+if [[ "${DEBUG}" == "y" ]]; then
+ set -x
+fi
+
+CONFIG_DIR="${POLICY_HOME}"/config
+for mainConfig in ${CONFIG_DIR}/logback.xml ${CONFIG_DIR}/logback-eelf.xml; do
+ if [ -e "${mainConfig}" ]; then
+ sed -i --follow-symlinks 's/${networkPattern}/${abstractNetworkPattern}/' "${mainConfig}"
+ fi
+done