diff --git a/.werks/16123.md b/.werks/16123.md new file mode 100644 index 00000000000..280b8c425dd --- /dev/null +++ b/.werks/16123.md @@ -0,0 +1,19 @@ +[//]: # (werk v2) +# Use the original message text for rewriting the comment field + +key | value +---------- | --- +date | 2024-09-11T13:54:07+00:00 +version | 2.3.0p17 +class | fix +edition | cre +component | ec +level | 1 +compatible | yes + +Werk 16534 made the rewriting of the comment field use the comment field +itself as the basis. For this field, it doesn't really make sense, because +rewriting is the only way to fill that field, so e.g. \0 was always empty. + +With this change, we revert to the old behaviour where all match groups +refer to the original message text. diff --git a/cmk/ec/main.py b/cmk/ec/main.py index 045c1ae6ff8..b3596aebb32 100644 --- a/cmk/ec/main.py +++ b/cmk/ec/main.py @@ -1465,9 +1465,7 @@ def rewrite_event( # pylint: disable=too-many-branches event["first"] = event["time"] event["last"] = event["time"] if "set_comment" in rule: - event["comment"] = replace_groups( - rule["set_comment"], event.get("comment", ""), match_groups - ) + event["comment"] = replace_groups(rule["set_comment"], event["text"], match_groups) if "set_text" in rule: event["text"] = replace_groups(rule["set_text"], event["text"], match_groups) if "set_host" in rule: diff --git a/cmk/gui/mkeventd/wato.py b/cmk/gui/mkeventd/wato.py index 2ede43a1cce..c13fd7fd8e8 100644 --- a/cmk/gui/mkeventd/wato.py +++ b/cmk/gui/mkeventd/wato.py @@ -1354,7 +1354,7 @@ def vs_mkeventd_rule(customer: str | None = None) -> Dictionary: "etc. matching group." ) + _( - "The placeholder \\0 will be replaced by the original text of this field. " + "The placeholder \\0 will be replaced by the original message text. " "This allows you to add new information at the beginning or at the end." ), size=64,