diff --git a/pkg/custompluginmonitor/custom_plugin_monitor.go b/pkg/custompluginmonitor/custom_plugin_monitor.go index 88ea084a4..0c524872c 100644 --- a/pkg/custompluginmonitor/custom_plugin_monitor.go +++ b/pkg/custompluginmonitor/custom_plugin_monitor.go @@ -232,6 +232,7 @@ func (c *customPluginMonitor) generateStatus(result cpmtypes.Result) *types.Stat condition.Type, status, newReason, + newMessage, timestamp, ) diff --git a/pkg/systemlogmonitor/log_monitor.go b/pkg/systemlogmonitor/log_monitor.go index ffe25f25f..5528a22ab 100644 --- a/pkg/systemlogmonitor/log_monitor.go +++ b/pkg/systemlogmonitor/log_monitor.go @@ -192,6 +192,7 @@ func (l *logMonitor) generateStatus(logs []*logtypes.Log, rule systemlogtypes.Ru condition.Type, types.True, rule.Reason, + message, timestamp, )) } diff --git a/pkg/systemlogmonitor/log_monitor_test.go b/pkg/systemlogmonitor/log_monitor_test.go index e68aaa4d3..ac18e9e14 100644 --- a/pkg/systemlogmonitor/log_monitor_test.go +++ b/pkg/systemlogmonitor/log_monitor_test.go @@ -84,6 +84,7 @@ func TestGenerateStatusForConditions(t *testing.T) { testConditionA, types.True, "test reason", + "test message 1\ntest message 2", time.Unix(1000, 1000), )}, Conditions: []types.Condition{ diff --git a/pkg/util/helpers.go b/pkg/util/helpers.go index 22528d6e7..d58e88cd2 100644 --- a/pkg/util/helpers.go +++ b/pkg/util/helpers.go @@ -23,12 +23,12 @@ import ( ) // GenerateConditionChangeEvent generates an event for condition change. -func GenerateConditionChangeEvent(t string, status types.ConditionStatus, reason string, timestamp time.Time) types.Event { +func GenerateConditionChangeEvent(t string, status types.ConditionStatus, reason, message string, timestamp time.Time) types.Event { return types.Event{ Severity: types.Info, Timestamp: timestamp, Reason: reason, - Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s", t, status, reason), + Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s, message: %q", t, status, reason, message), } }