Adding RP_LOG_KEYWORDS and RP_BLACKLISTED_LOGS to the settings
Related_Prod: PRODX-54314
Change-Id: I57478b76f81f5de5b0174aedcc83afe33faad26e
diff --git a/rp_reporter/rp_reporter/batch_reporter.py b/rp_reporter/rp_reporter/batch_reporter.py
index 1c8f584..e0ad07d 100755
--- a/rp_reporter/rp_reporter/batch_reporter.py
+++ b/rp_reporter/rp_reporter/batch_reporter.py
@@ -22,8 +22,11 @@
from rp_reporter.settings import JENKINS_USER, JENKINS_PASSWORD
from rp_reporter.settings import RP_LOGGING
+from rp_reporter.settings import RP_BLACKLISTED_LOGS, RP_LOG_KEYWORDS
+
LOG = logging.getLogger("rp_reporter")
+print(RP_BLACKLISTED_LOGS)
def setup_logging(job: str | jj.Build):
if isinstance(job, str):
@@ -219,25 +222,9 @@
status = "FAILED"
# add logs to test
- catch_logs = [
- "failure",
- "failed",
- "error",
- "exception",
- "assert",
- "discovered openstack controller version is",
- ]
-
- blacklist = [
- "[Pipeline] error",
- "failureDomain:",
- "portprober_arping_target_failure",
- "ingress:[error-pages:",
- ]
-
all_logs = job.get_logs()
for log in grep(
- text=all_logs, patterns=catch_logs, context_size=8, blacklist=blacklist
+ text=all_logs, patterns=RP_LOG_KEYWORDS, context_size=8, blacklist=RP_BLACKLISTED_LOGS
):
# LOG.error("Attach logs {}".format("\n".join(log)))
rp_client.log(time=timestamp(), message="\n".join(log), item_id=subjob_item_id)
diff --git a/rp_reporter/rp_reporter/settings.py b/rp_reporter/rp_reporter/settings.py
index ddd2314..79becde 100644
--- a/rp_reporter/rp_reporter/settings.py
+++ b/rp_reporter/rp_reporter/settings.py
@@ -73,6 +73,47 @@
environ.get("RP_LOG_BATCH_SIZE") or from_conf("RP_LOG_BATCH_SIZE") or 20
)
+RP_LOG_KEYWORDS = (
+ environ.get("RP_LOG_KEYWORDS", "").split(",")
+ if environ.get("RP_LOG_KEYWORDS")
+ else False or from_conf("RP_LOG_KEYWORDS") or [
+ "failure",
+ "fatal"
+ "failed",
+ "error",
+ "exception",
+ "assert",
+ "discovered openstack controller version is",
+ ]
+)
+
+RP_BLACKLISTED_LOGS = (
+ environ.get("RP_BLACKLISTED_LOGS", "").split(",")
+ if environ.get("RP_BLACKLISTED_LOGS")
+ else False or from_conf("RP_BLACKLISTED_LOGS") or [
+ "[Pipeline] error",
+ "failureDomain:",
+ "portprober_arping_target_failure",
+ "ingress:[error-pages:",
+ "templates/deployment-error.yaml",
+ "templates/service-error.yaml",
+ "rockoon/rockoon/exception.py",
+ "rockoon/rockoon/exporter/exceptions.py",
+ "AssertResult",
+ "AssertTimestamp",
+ "ignore_errors=",
+ "FailureAction",
+ "OnFailureJobMode",
+ "StandardError",
+ "SystemCallErrorNumber",
+ "TimeoutStartFailureMode",
+ "continue_on_error",
+ "failed=0",
+ "Naive assertion of",
+ "All assertions passed"
+ ]
+)
+
JENKINS_USER = (
environ.get('JENKINS_USER') or from_conf("JENKINS_USER")
)