From 1f2c6939733bbb601157875bc51e247a5df798f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yves=20M=C3=BCller?= Date: Mon, 9 Dec 2019 16:34:47 +0100 Subject: [PATCH] introduce option to overwrite journald parser Since journald might contain different formats of logs, there should be an option to set the parser associated with the data. I can now setup parser like `journald_myapplication` in scalyr. --- scalyr_agent/builtin_monitors/journald_monitor.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scalyr_agent/builtin_monitors/journald_monitor.py b/scalyr_agent/builtin_monitors/journald_monitor.py index 417ca37603..f7702f37cd 100644 --- a/scalyr_agent/builtin_monitors/journald_monitor.py +++ b/scalyr_agent/builtin_monitors/journald_monitor.py @@ -117,6 +117,14 @@ default=10 * 60, ) +define_config_option( + __monitor__, + "parser", + "Allow to override the parser used for journald entries", + convert_to=str, + default="journald", +) + # this lock must be held to access the # _global_checkpoints dict _global_lock = threading.Lock() @@ -256,7 +264,7 @@ def _initialize(self): self._poll = None # override the sample_interval self.set_sample_interval(self._config.get("journal_poll_interval")) - self.log_config["parser"] = "journald" + self.log_config["parser"] = self._config.get("parser") self._extra_fields = self._config.get("journal_fields") self._last_cursor = None