summaryrefslogtreecommitdiffstats
path: root/roles/openshift_logging/filter_plugins
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2017-03-07 19:45:36 -0500
committerGitHub <noreply@github.com>2017-03-07 19:45:36 -0500
commit766128bf66cbc45cb2c2539dec0472e7d378a3fb (patch)
tree9a86bc79677e0dddbaa285e912512e32efbbb945 /roles/openshift_logging/filter_plugins
parentd3da4d1817d54b9c3aef9fffa6ad166ec950e830 (diff)
parentab88af6414729556cabf4bde7cbb4ea83b183e3f (diff)
downloadopenshift-766128bf66cbc45cb2c2539dec0472e7d378a3fb.tar.gz
openshift-766128bf66cbc45cb2c2539dec0472e7d378a3fb.tar.bz2
openshift-766128bf66cbc45cb2c2539dec0472e7d378a3fb.tar.xz
openshift-766128bf66cbc45cb2c2539dec0472e7d378a3fb.zip
Merge pull request #3558 from ewolinetz/logging_metrics_defaults
Adding some more logging and metrics defaults
Diffstat (limited to 'roles/openshift_logging/filter_plugins')
-rw-r--r--roles/openshift_logging/filter_plugins/openshift_logging.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/roles/openshift_logging/filter_plugins/openshift_logging.py b/roles/openshift_logging/filter_plugins/openshift_logging.py
index 007be3ac0..f0007dfc7 100644
--- a/roles/openshift_logging/filter_plugins/openshift_logging.py
+++ b/roles/openshift_logging/filter_plugins/openshift_logging.py
@@ -25,6 +25,13 @@ def entry_from_named_pair(register_pairs, key):
raise RuntimeError("There was no entry found in the dict that had an item with a name that matched {}".format(key))
+def map_from_pairs(source, delim="="):
+ ''' Returns a dict given the source and delim delimited '''
+ if source == '':
+ return dict()
+
+ return dict(source.split(delim) for item in source.split(","))
+
# pylint: disable=too-few-public-methods
class FilterModule(object):
''' OpenShift Logging Filters '''
@@ -35,4 +42,5 @@ class FilterModule(object):
return {
'random_word': random_word,
'entry_from_named_pair': entry_from_named_pair,
+ 'map_from_pairs': map_from_pairs,
}