Splunk Enterprise

How to sort out values greater that a certain number in a table?

chinmay25
Path Finder

Hello,

I have the following query that I am working with and it generates a table with multiple counts for various ports at 15 min intervals.

index=abc source=xyz  SMF119HDSubType=2
| timechart span=15m count by SMF119AP_TTLPort_0001 usenull=f useother=f | stats values(*) as * by _time
| table _time Port1 Port2

The result is the following table. I only want to display results more that 5000 counts. I am trying to use the where Port 2>5000 command. But it does not work. I am only displaying 2 port columns. However, I have several other ports to monitor as well.

_timePort1Port2
2023-08-09 09:30:008002700
2023-08-09 09:45:0012004800
2023-08-09 10:00:0013005300
2023-08-09 10:15:006008000
2023-08-09 10:30:0040013500

 

I would appreciate your inputs.

 

Thank you,

 

Chinmay.

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| untable time port count
| where count > 5000
| xyseries time port count

View solution in original post

chinmay25
Path Finder

The solution worked perfectly for the count over 5000.

How can I combine the query for count greater than 5000 with the following query that generates the percent data. I want to set an alert only when the count is greater that 5000 and EDCD > 90

index=abc source=xyz (SYSNAME=EDCD) ((date_wday=tuesday AND date_hour=*) OR (date_wday=wednesday AND date_hour=*) OR (date_wday=thursday AND date_hour=*) OR (date_wday=friday AND date_hour=*) OR (date_wday=monday AND date_hour=10) OR (date_wday=monday AND date_hour=11) OR (date_wday=monday AND date_hour=12) OR (date_wday=monday AND date_hour=13) OR (date_wday=monday AND date_hour=14) OR (date_wday=monday AND date_hour=15) OR (date_wday=monday AND date_hour=16) OR (date_wday=monday AND date_hour=17) OR (date_wday=monday AND date_hour=18) OR (date_wday=monday AND date_hour=19) OR (date_wday=monday AND date_hour=20) OR (date_wday=monday AND date_hour=21) OR (date_wday=monday AND date_hour=22) OR (date_wday=monday AND date_hour=23) OR (date_wday=saturday AND date_hour=0) OR (date_wday=saturday AND date_hour=1) OR (date_wday=saturday AND date_hour=2) OR (date_wday=saturday AND date_hour=3) OR (date_wday=saturday AND date_hour=4) OR (date_wday=saturday AND date_hour=5) OR (date_wday=saturday AND date_hour=6) OR (date_wday=saturday AND date_hour=7))
| bin _time span=1h
| eval CPU = round(RCVCPUA/16,2), Hour = date_hour
| chart eval(round(avg(CPU),2)) as "CPU" over Hour by SYSNAME

 

This query generates a table as follows

HourEDCD
843.5
976.2
1091.5

 

Thank you,

Chinmay.

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It is not at all clear how you want these two searches combined.

0 Karma

chinmay25
Path Finder

I am having that trouble too. So we want to be alerted when both conditions meet. The count is over 5000 and the EDCD percent is above 90%.

Right now I have 2 separate alerts one for count over 5000 and another for EDCD percent above 90%.

Is there a way we can combine the two using a AND clause.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It depends on what you want to compromise - you have different time spans, different time ranges(?), different filters.

You could try appending one search to the other but you might run into subsearch limitations.

To be honest, I think it would complicate it too much for the sake of not have two alerts. It doesn't seem worth it to me.

0 Karma

chinmay25
Path Finder

I have the following query that gives the count for port and CPU percent. 

index=abc source=xyz SMFID=EDCD SMF119HDSubType=2
| timechart span=60m count by SMF119AP_TTLPort_0001 usenull=f useother=f | stats values(*) as * by _time
| untable _time Port Count
| where Count > 4000 | eval DATE = strftime(_time,"%m/%d/%y %H:%M:%S.%2N")
| eval Date = substr(DATE,1,9) | eval Hours = substr(DATE, 11,18)
| appendcols [search index=abc source=xyz (SYSNAME=EDCD) ((date_wday=tuesday AND date_hour=*) OR (date_wday=wednesday AND date_hour=*) OR (date_wday=thursday AND date_hour=*) OR (date_wday=friday AND date_hour=*) OR (date_wday=monday AND date_hour=10) OR (date_wday=monday AND date_hour=11) OR (date_wday=monday AND date_hour=12) OR (date_wday=monday AND date_hour=13) OR (date_wday=monday AND date_hour=14) OR (date_wday=monday AND date_hour=15) OR (date_wday=monday AND date_hour=16) OR (date_wday=monday AND date_hour=17) OR (date_wday=monday AND date_hour=18) OR (date_wday=monday AND date_hour=19) OR (date_wday=monday AND date_hour=20) OR (date_wday=monday AND date_hour=21) OR (date_wday=monday AND date_hour=22) OR (date_wday=monday AND date_hour=23) OR (date_wday=saturday AND date_hour=0) OR (date_wday=saturday AND date_hour=1) OR (date_wday=saturday AND date_hour=2) OR (date_wday=saturday AND date_hour=3) OR (date_wday=saturday AND date_hour=4) OR (date_wday=saturday AND date_hour=5) OR (date_wday=saturday AND date_hour=6) OR (date_wday=saturday AND date_hour=7))
| bin span=1h@h _time | eval "Hours"=strftime('_time',"%H:%M:%S.%2N") | eval DATE = strftime('_time',"%m/%d/%y %H:%M:%S.%2N") | eval Date = substr(DATE, 1,9)
| eval CPU = round(RCVCPUA/16,2)
| stats avg(CPU) as "CPU" by Hours Date | eval CPU=round(CPU,2)
]
| table Date Hours Port Count CPU

This generates the following result. I want to set an alert only when the count is >5000 and CPU >80. What combined statement can be used to get the desired result?

 

DateHoursPortCountCPU
08/22/237:00:00.00230507578738.42
08/22/238:00:00.00230501985484.56
08/22/239:00:00.0023008412637.16
08/22/239:00:00.00230502012135.71
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| untable time port count
| where count > 5000
| xyseries time port count
Get Updates on the Splunk Community!

New Case Study Shows the Value of Partnering with Splunk Academic Alliance

The University of Nevada, Las Vegas (UNLV) is another premier research institution helping to shape the next ...

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

October 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...