Hi, I successfully created an SPL that does what I need for a single host but I cannot get it to work for all hosts. This works index=<my_index> host=<specific_host> sourcetype=<my_sourcetype> instance=_Total counter="% Processor Time"
| sort host, -_time
| dedup 2 host
| lookup <my_lookup> resource_name as host output businessprocess_name
| search businessprocess_name = "<my_business_process_name>"
| eval Value = round(Value,2)
| delta Value AS ValueDelta
| eval lowerThreshold = -25
| eval upperThreshold = 25
| eval CreateEvent = if((ValueDelta > upperThreshold OR ValueDelta < lowerThreshold),"Yes","No")
| search CreateEvent = "Yes"
| eval metric_type = "CPU Usage Anomaly"
| eval description = if(ValueDelta < 0,"CPU Usage is now: " + Value + "%. A decrease of " + ValueDelta,"CPU Usage is now: " + Value + "%. An increase of " + ValueDelta)
| table _time, host, businessprocess_name, metric_type, description The output of that SPL is (changed the lower and upper threshold to trigger a result) _time host businessprocess_name metric_type description 2021-05-05 12:35:57 <specific_host> <my_business_process_name> CPU Usage Anomaly CPU Usage is now: 57.52951309736281%. A decrease of -3.69007662538445 I know the sort on host does not make sense in this SPL but it nicely takes the last values, compares it and based on the difference the result is what it needs to be. When I remove the host=<specific_host> and run it on all the hosts in the system the output is wrong. It seems that it is comparing value of row 1 (server A) with the value of row 2 (server A), then value of row 2 (again server A) with the value on row 3 (server B), etc etc. I guess that makes sense but not what I am looking for. What would be needed to run the calculation of the delta for only the two records that belong to the same host? What I am aiming to do is to create an event when the difference in the CPU usage between the last two values is more then the configured threshold, whether it drops or increases. Maybe I am going about it the wrong way with the Delta command?
... View more