Analytic Rule does not display incident while In hunting there is events.




There is a problem with an analytic rule i have created to correlate between ThreatIntelligenceIndicator & DeviceNetworkEvents, when i run the KQL query of the analytic in Log Hunting there are events in the result as shown in the photo.


But, when i tried to simulate the results from Analytic rule configuration, no data appear.



Also, when i clicked on view query results no result data appeared also, but as shown the time range is changed to custom by default.




When i changed the time range to Set in query, result data appeared.




Is there any changes i should do to make the event simulated as an incident in the analytic rule?


Thank you.

8 Replies
How did you setup the Query Scheduling and Alert threshold?
Also, is this a regular analytics rule, or is it an NRT rule?

It's regular analytics rule
best response confirmed by Qusai_Ismail (Contributor)
IIRC, the "time set in query" will be overruled by the analytics rule time settings. To do something similar to alert on potential C2C comms (compare NetworkIPs from ThreatIntelligenceIndicator to FW logs) I had to use a join.

ThreatIntelligenceIndicator | where NetworkIP != "" | join (FW_DATA_Table_or_Function | where TimeGenerated >= now()-1d | project-rename NetworkIP = Dst_IP) on NetworkIP
| project TimeGenerated1, Name, Src_IP, NetworkIP, Dst_Port, Protocol | sort by TimeGenerated1 desc

Thanks for your replay, but the time in analytic rule setting is same as i set in the query, both are 1h.
This is another example i'm trying to do.

| where TimeGenerated > ago(360d)
| where isnotempty(Url)
| join (EmailUrlInfo
| where TimeGenerated >= now()-1d) on Url
| join (EmailEvents | where TimeGenerated >= now()-1d) on NetworkMessageId
| project TimeGenerated , NetworkMessageId, SenderFromAddress, RecipientEmailAddress, Url , DeliveryAction, DeliveryLocation

The analytic rule is for checking IOC URLs in EmailsEvents that have URLs.
Analytic rule settings are :
Run Query every : 5 minutes
Lookup data from the last: 1 Day

When i tested the KQL Query in Log hunting, there is an event in the result, but when trying to test it in Analytic , Simulating result has no result, and no incident generated.

Thank you.

Swap the join around? I'm thinking the analytic rule test may be limiting things. So put your EmailEvents first with 1d, and then do a join to ThreatIntelligenceIndicator with ago(360) and it may work.
Thanks , as you said the set time in query is overruled by rule setting, so i changed the query to be like this

let dt_lookBack = 1h;
let ioc_lookBack = 14d;
| where TimeGenerated >= ago(ioc_lookBack) and ExpirationDateTime > now()
| summarize LatestIndicatorTime = arg_max(TimeGenerated, *) by IndicatorId
| where Active == true
| where isnotempty(Url)
| join kind=innerunique (
| extend IngestionTime = ingestion_time()
| where IngestionTime > ago(dt_lookBack)
) on $left.Url == $right.Url

Run query every 1 hour
Lookup data from the last 14 days

All is done and it's worked.

thank you.