From 2c1155bf6571cf50dc09e05baaa0231ed83f0fa1 Mon Sep 17 00:00:00 2001 From: Felix Mueller Date: Wed, 6 Dec 2017 10:41:36 +0100 Subject: [PATCH] Adding support for WATCHER_SCALYR_SERVER This is an exact replica of #51. --- kube_log_watcher/agents/scalyr.py | 2 ++ kube_log_watcher/templates/scalyr.json.jinja2 | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/kube_log_watcher/agents/scalyr.py b/kube_log_watcher/agents/scalyr.py index 25b913d..286ae6b 100644 --- a/kube_log_watcher/agents/scalyr.py +++ b/kube_log_watcher/agents/scalyr.py @@ -26,6 +26,7 @@ class ScalyrAgent(BaseWatcher): def __init__(self, cluster_id: str, load_template): self.api_key = os.environ.get('WATCHER_SCALYR_API_KEY') self.dest_path = os.environ.get('WATCHER_SCALYR_DEST_PATH') + self.scalyr_server = os.environ.get('WATCHER_SCALYR_SERVER'):144 if not all([self.api_key, self.dest_path]): raise RuntimeError('Scalyr watcher agent initialization failed. Env variables WATCHER_SCALYR_API_KEY and ' @@ -142,6 +143,7 @@ def flush(self): 'cluster_id': self.cluster_id, 'logs': self.logs, 'monitor_journald': self.journald, + 'scalyr_server': self.scalyr_server, } current_paths = self._get_current_log_paths() diff --git a/kube_log_watcher/templates/scalyr.json.jinja2 b/kube_log_watcher/templates/scalyr.json.jinja2 index f8c7fb3..811f7e2 100644 --- a/kube_log_watcher/templates/scalyr.json.jinja2 +++ b/kube_log_watcher/templates/scalyr.json.jinja2 @@ -8,6 +8,10 @@ "serverHost": "{{ cluster_id }}" }, + {% if scalyr_server %} + "scalyr_server": "{{ scalyr_server }}", + {% endif %} + "logs": [ {% for log in logs %} {