I’ve got an event with an associated notification (Slack). I am filtering for messages containing a tag I added via a Pipeline. I want to only receive a single event if multiple messages are picked up by the filter, so I am setting an aggregation using “Group by Field(s)”. This works like a charm - however, the associated notification seems to be having data stripped from it.
Example:
I am aggregating on the field:
winlogbeat_winlog_event_data_TargetUserName
I am setting event fields as follows:
Field Name Is Key? Value Source Data Type Configuration
event_id No Template string template: "${source.winlogbeat_winlog_event_id}"require_values: false
hostname No Template string template: "${source.winlogbeat_host_name}"require_values: false
ipaddress No Template string template: "${source.winlogbeat_winlog_event_data_IpAddress}"require_values: false
service_name No Template string template: "${source.winlogbeat_winlog_event_data_ServiceName}"require_values: false
task No Template string template: "${source.winlogbeat_winlog_task}"require_values: false
username No Template string template: "${source.winlogbeat_winlog_event_data_TargetUserName}"require_values: false
My notification is set as:
--- [Event] --------------------------------------
Title: ${event_definition_title}
Timestamp: ${event.timestamp}
Username: ${event.fields.username}
Hostname: ${event.fields.hostname}
IP Address: ${event.fields.ipaddress}
Task: ${event.fields.task}
Event ID: ${event.fields.event_id}
${if backlog}
--- [Backlog] ------------------------------------
Last messages accounting for this alert:
${foreach backlog message}
${end}${end}
In the actual notification though, the values for Hostname, IP Address, Task, and Event ID are stripped, see example below:
Alert EventName triggered:
EventDescription
— [Event] --------------------------------------
Title: Event Title
Timestamp: 2024-03-19T15:40:14.691Z
Username: username_here
Hostname:
IP Address:
Task:
Event ID:
— [Backlog] ------------------------------------
Last messages accounting for this alert:
Setting any/some/all of the event fields to be a key, has no noticeable effect.
Since those messages are coming in from winlogbeat it change the field/s naming convention.
either you can disable that or edit the template to something like this.
--- [Event] --------------------------------------
Title: ${event_definition_title}
Timestamp: ${event.timestamp}
Username: ${event.fields.username}
Hostname: ${event.fields.hostname}
IP Address: ${event.fields.ipaddress}
Task: ${event.fields.task}
Event ID: ${event.fields.event_id}
${if backlog}
--- [Backlog] ------------------------------------
Last messages accounting for this alert:
${foreach backlog message}
Source: ${message.source}
EventID: ${message.fields.winlogbeat_winlog_event_id}
HostName: ${message.fields.winlogbeat_host_name}
IP Address: ${message.fields.winlogbeat_winlog_event_data_IpAddress}
TargetUserName: ${message.fields.winlogbeat_winlog_event_data_TargetUserName}
Logon Type: ${message.fields.LogonType}
${end}${end}
@gsmith Thanks for the reply! I copy/pasted the notification as you re-wrote it, but unfortunately the fields are still empty – the backlog has the info however?
— [Event] --------------------------------------
Title: AD Domain Admin: Multiple Failed Logins
Timestamp: 2024-03-20T12:37:15.740Z
Username: username_here
Hostname:
IP Address:
Task:
Event ID:
— [Backlog] ------------------------------------
Last messages accounting for this alert:
Source: dc1
EventID: 4771
HostName: dc1.contoso.com
IP Address: ::ffff:169.254.123.111
TargetUserName: username_here
Logon Type:
If you want to extract a field from your message you need to add the following under Fields section. The SOMEFIELD needs to match what is in the message your try to get. EVENT’s are another entity.
Example:
SomeName: ${message.fields.SOMEFIELD}
Here is an example from that post I link above.
This is just an example you need to modify it for your environment.
@gsmith Thanks for working through this with me! So, if I’m understanding correctly, to get the data from winlogbeat into the event, instead of defining this within the event definition itself as an event field, ex:
@gsmith Thanks for working with me on this, and sorry if I’m taking a bit to figure stuff out… but here’s the thing, which I think might be a bug or I’m doing something wrong…
This works perfectly for the backlog (like you pointed out) … but for the event, it’s blank?
As an example:
--- [Event] --------------------------------------
Title: ${event_definition_title}
Timestamp: ${event.timestamp}
Username: ${event.fields.username}
Hostname: ${message.fields.winlogbeat_host_name}
IP: ${message.fields.winlogbeat_winlog_event_data_IpAddress}
Service Name: ${message.fields.winlogbeat_winlog_event_data_ServiceName}
Task: ${message.fields.winlogbeat_winlog_task}
Event Id: ${message.fields.winlogbeat_winlog_event_id}
--- [Backlog] ------------------------------------
Last messages accounting for this alert:
${foreach backlog message}
Source: ${message.source}
EventID: ${message.fields.winlogbeat_winlog_event_id}
HostName: ${message.fields.winlogbeat_host_name}
IP Address: ${message.fields.winlogbeat_winlog_event_data_IpAddress}
TargetUserName: ${message.fields.winlogbeat_winlog_event_data_TargetUserName}
Logon Type: ${message.fields.LogonType}
${end}${end}
If I stitch this together from previous posts, this would result in something like this:
Title: AD Domain Admin: Successful Login
Timestamp: 2024-03-26T17:23:13.845Z
Username:
Hostname:
IP:
Service Name:
Task:
Event Id:
— [Backlog] ------------------------------------
Last messages accounting for this alert:
Source: dc1
EventID: 4771
HostName: dc1.contoso.com
IP Address: ::ffff:169.254.123.111
TargetUserName: username_here
Logon Type:
This section is probably what you want to configure. This will add or subtract the information you want when you send a notification. I believe this already works for you since you posted this above.