Move out the slack message format so that we can customize it easily

Change-Id: I5dca828d672c00d871c657c68b130b4e71721a29
diff --git a/logging/opendistro_setting/templates/configmap-script.yml b/logging/opendistro_setting/templates/configmap-script.yml
index 77715c7..f28c55a 100644
--- a/logging/opendistro_setting/templates/configmap-script.yml
+++ b/logging/opendistro_setting/templates/configmap-script.yml
@@ -108,6 +108,7 @@
         for k in $(jq ' keys | .[]' "$config_file"); do
             file=$dir/$(jq -r ".[$k].file" "$config_file");
             dest_name=$(jq -r ".[$k].destination" "$config_file");
+            format=$(jq -r ".[$k].format" "$config_file");
 
             dest_id=$(check_destination "$dest_name")
             if [ -z "$dest_id" ]; then
@@ -116,11 +117,15 @@
             fi
 
             name=$(jq -r '.name' "$file")
+
+            ## Replace the slack output format
+            FILENAME=$(mktemp)
+            jq --arg slack "${format}" '.triggers[0].actions[0].message_template.source=$slack' "$file" > "$FILENAME"
             monitor_id=$(check_monitor "$name")
             if [ "$monitor_id" = "null" ]; then
-                create_monitor "$file" "$dest_id"
+                create_monitor "$FILENAME" "$dest_id"
             else
-                update_monitor "$file" "$dest_id" "$monitor_id"
+                update_monitor "$FILENAME" "$dest_id" "$monitor_id"
             fi
         done