diff --git a/kube_log_watcher/agents/scalyr.py b/kube_log_watcher/agents/scalyr.py index b5f0668..78d1200 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') 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..3024dab 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 %} {