Splunk Search

how to get a search results in ascending order (time wise). every time its giving in different order..please help me....

marees123
Path Finder
*swt* "changed state to" */*/* | rex "(?i) Interface (?P[^,]+)" | rex "(?i)changed state to (?P.+)" | table host, AnInterface, UpDown, _time

this is the query im using.. everytime it gives different order.... please help me out....

Tags (2)
0 Karma
1 Solution

MuS
Legend

Hi marees123,

how about something like this:

*swt* "changed state to" */*/* | rex "(?i) Interface (?P[^,]+)" | rex "(?i)changed state to (?P.+)" | table host, AnInterface, UpDown, _time | sort +_time

or

*swt* "changed state to" */*/* | rex "(?i) Interface (?P[^,]+)" | rex "(?i)changed state to (?P.+)" | table host, AnInterface, UpDown, _time | reverse

or

*swt* "changed state to" */*/* | rex "(?i) Interface (?P[^,]+)" | rex "(?i)changed state to (?P.+)" | chart values(AnInterface) AS AnInterface values(UpDown) AS UpDown over _time by host

hope this helps ...

cheers, MuS

View solution in original post

MuS
Legend

Hi marees123,

how about something like this:

*swt* "changed state to" */*/* | rex "(?i) Interface (?P[^,]+)" | rex "(?i)changed state to (?P.+)" | table host, AnInterface, UpDown, _time | sort +_time

or

*swt* "changed state to" */*/* | rex "(?i) Interface (?P[^,]+)" | rex "(?i)changed state to (?P.+)" | table host, AnInterface, UpDown, _time | reverse

or

*swt* "changed state to" */*/* | rex "(?i) Interface (?P[^,]+)" | rex "(?i)changed state to (?P.+)" | chart values(AnInterface) AS AnInterface values(UpDown) AS UpDown over _time by host

hope this helps ...

cheers, MuS

marees123
Path Finder

Hi Mus,

I'm using the below query as you suggested,

 *swt* "changed state to" */*/* | rex "(?i) Interface (?P[^,]+)" | rex "(?i)changed state to (?P.+)" | table host, AnInterface, UpDown, _time | sort -_time | reverse

Could any one please provide the script, so that splunk will send the below logs to netcool.

data1swt0001    GigabitEthernet1/0/1    down    2015-01-24 23:48:38
data1swt0001    GigabitEthernet1/0/1    down    2015-01-24 23:48:38

data1swt0001    GigabitEthernet1/0/1    up  2015-01-24 23:52:08
data1swt0001    GigabitEthernet1/0/1    up  2015-01-24 23:52:08

Thanks....

0 Karma

marees123
Path Finder

its working perfect... thanks a ton.......

0 Karma

MuS
Legend

you're welcome 😉

0 Karma
Get Updates on the Splunk Community!

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...

Adoption of Infrastructure Monitoring at Splunk

  Splunk's Growth Engineering team showcases one of their first Splunk product adoption-Splunk Infrastructure ...

Modern way of developing distributed application using OTel

Recently, I had the opportunity to work on a complex microservice using Spring boot and Quarkus to develop a ...