From ec7ffd11afdf510b65ee96502afa6d1be43feee3 Mon Sep 17 00:00:00 2001 From: Scott Huang Date: Mon, 7 Oct 2024 13:50:22 +0800 Subject: [PATCH 1/2] Add more debug log --- metaphor/postgresql/extractor.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/metaphor/postgresql/extractor.py b/metaphor/postgresql/extractor.py index c963e9f4..1c5195ab 100644 --- a/metaphor/postgresql/extractor.py +++ b/metaphor/postgresql/extractor.py @@ -436,15 +436,19 @@ def _process_cloud_watch_log( return None parsed = parse_postgres_log(log) + if parsed is None: + return None - # Skip log without user and database, and log_level of SQL statement is "LOG" - if ( - parsed is None - or not parsed.user - or not parsed.database - or parsed.log_level != "LOG" - or parsed.user in self._query_log_config.excluded_usernames - ): + if not parsed.user or not parsed.database: + logger.debug(f"Invalid user or database, log: {log}") + return None + + if parsed.log_level != "LOG": + logger.debug(f"Skip {parsed.log_level} log: {log}") + return None + + if parsed.user in self._query_log_config.excluded_usernames: + logger.debug(f"Skip {parsed}'s query") return None previous_line = previous_line_cache.get(parsed.session) From e5834d2a8ceea5a2db350182b438331ae1f2c847 Mon Sep 17 00:00:00 2001 From: Scott Huang Date: Mon, 7 Oct 2024 13:51:04 +0800 Subject: [PATCH 2/2] Bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index de2f7f42..33ccc46a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "metaphor-connectors" -version = "0.14.114" +version = "0.14.115" license = "Apache-2.0" description = "A collection of Python-based 'connectors' that extract metadata from various sources to ingest into the Metaphor app." authors = ["Metaphor "]