Thank you for your response, @Fin_Ubels.
We technically don’t have to use the eventtime Dimension in our Metric Event, as all we really care about is the presence of the member_uuid.
I’m mainly using it to illustrate to you that the member_uuid record shows up multiple times in the logs (and is sorted by eventime) and all we want to see is the most recent record.
You are correct. Using a DQL query works as expected. We can both sort and remove any duplicate member_uuids.
However, when we create the custom Log Metric, we can’t use the full DQL. We are limited with what we can use in the Matcher.
We also don’t want to schedule and execute a full DQL query (using a Notebook or Dashboard) to retrieve these log records, as that is what creating a custom Log Metric is for.
The issue is that the log records themselves contain multiple records of the same member_uuid.
Here’s a bit more context on what exactly we are trying to alert on.
We are planing to alert when the DQL query below returns any records. Value > 0.
I decided to create 2 separate Log Metrics, as these are technically 2 separate DQL queries that are joined. Each query is for a different entity’s logs.
My thought is to use a Metric Expression in our Metric Event.
When Log Metric 1 + Log Metric 2 = 2, send us an alert.
We only care about a member_uuid that appears in BOTH Log Metrics at the same time.
1 + 1 = 2
fetch logs
| filter dt.system.bucket == "bucket_name_1"
| filter dt.host_group.id == "host_group_id_name"
| parse content, "JSON:event"
| filter event[message] == "message_name"
| filter event[product_type] == "product_type_name"
| fieldsAdd member_uuid = event[member_uuid]
| join [
fetch logs
| filter dt.system.bucket == "bucket_name_2"
| filter ecs_cluster == "ecs_cluster_name"
| filter matchesValue(requirement, "requirement_name")
| dedup member_uuid, sort: { timestamp desc }
], on: { member_uuid }
| filter right.requirement_status == "requirement_status_name"