From dd019cb28a6a12124714c08068372cfa9a798aca Mon Sep 17 00:00:00 2001 From: Mark Bonsack Date: Mon, 23 Mar 2020 15:32:41 -0700 Subject: [PATCH] Update example log path to inclucde alt destination * Update `lp-example.conf.tmpl` to include env variable support for alternate destinations --- .../local/config/log_paths/lp-example.conf.tmpl | 13 +++++++++++++ .../etc/local_config/log_paths/lp-example.conf.tmpl | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/package/etc/conf.d/local/config/log_paths/lp-example.conf.tmpl b/package/etc/conf.d/local/config/log_paths/lp-example.conf.tmpl index 708bc7c..918530b 100644 --- a/package/etc/conf.d/local/config/log_paths/lp-example.conf.tmpl +++ b/package/etc/conf.d/local/config/log_paths/lp-example.conf.tmpl @@ -83,6 +83,19 @@ log { destination(d_archive); {{- end}} +{{- /* Check environment variables for sending to a global list of alternate destinations */}} + +{{- if (print (getenv "SC4S_DEST_GLOBAL_ALTERNATES")) }} + {{ getenv "SC4S_DEST_GLOBAL_ALTERNATES" | regexp.ReplaceLiteral "^" "destination(" | regexp.ReplaceLiteral "[, ]+" ");\n destination(" }}); +{{- end }} + +{{- /* Check environment variables for sending to a list of alternate destinations only for this specific source */}} + +{{- if (print (getenv "SC4S_DEST_LOCAL_EXAMPLE_ALTERNATES")) }} + {{ getenv "SC4S_DEST_LOCAL_EXAMPLE_ALTERNATES" | regexp.ReplaceLiteral "^" "destination(" | regexp.ReplaceLiteral "[, ]+" ");\n destination(" }}); +{{- end }} + + # All passes through any matching log path will be final flags(flow-control,final); }; \ No newline at end of file diff --git a/package/etc/local_config/log_paths/lp-example.conf.tmpl b/package/etc/local_config/log_paths/lp-example.conf.tmpl index 708bc7c..d168cc9 100644 --- a/package/etc/local_config/log_paths/lp-example.conf.tmpl +++ b/package/etc/local_config/log_paths/lp-example.conf.tmpl @@ -83,6 +83,18 @@ log { destination(d_archive); {{- end}} +{{- /* Check environment variables for sending to a global list of alternate destinations */}} + +{{- if (print (getenv "SC4S_DEST_GLOBAL_ALTERNATES")) }} + {{ getenv "SC4S_DEST_GLOBAL_ALTERNATES" | regexp.ReplaceLiteral "^" "destination(" | regexp.ReplaceLiteral "[, ]+" ");\n destination(" }}); +{{- end }} + +{{- /* Check environment variables for sending to a list of alternate destinations only for this specific source */}} + +{{- if (print (getenv "SC4S_DEST_LOCAL_EXAMPLE_ALTERNATES")) }} + {{ getenv "SC4S_DEST_LOCAL_EXAMPLE_ALTERNATES" | regexp.ReplaceLiteral "^" "destination(" | regexp.ReplaceLiteral "[, ]+" ");\n destination(" }}); +{{- end }} + # All passes through any matching log path will be final flags(flow-control,final); }; \ No newline at end of file