Splunk Search

Search Logs

IRHM73
Motivator

Hi, I wonder whether someone may be able to help me please.

From the answer I found here I'm using the query below to display searches that have been performed

index=_audit action=search info=granted search=* NOT "search_id='scheduler" NOT "search='|history" NOT "user=splunk-system-user" NOT "search='typeahead" NOT "search='| metadata type=* | search totalCount>0" | stats count by user search _time | sort _time | convert ctime(_time) | stats list(_time) as time list(search) as search by user

Could someone perhaps tell me please is there a way be which I can see how long the search took to run.

Many thanks and kind regards

Chris

Tags (1)
0 Karma
1 Solution

woodcock
Esteemed Legend

Try this:

| rest/services/search/jobs | fields *search* *duration* *sec*s

View solution in original post

0 Karma

woodcock
Esteemed Legend

Try this:

| rest/services/search/jobs | fields *search* *duration* *sec*s
0 Karma

IRHM73
Motivator

Hi @woodcock thank you for taking the time to come back to me with this.

I've tried the code snippet you kindly provided, but unfortunately I receive the following error:

Error in 'rest' command: This command
must be the first command of a search.

So I tried to moving this to the beginning of the search but this also doesn't work.

Any ideas where I may have gone wrong please?

Many thanks and kind regards

Chris

0 Karma

woodcock
Esteemed Legend

My solution is not an extension to your original search but a 100% replacement for it. I tested it on v6.2.3 and it works just fine as-is. Use my solution's search string exactly as-is and it should give you everything you need (but in a totally different format).

0 Karma

IRHM73
Motivator

Hi thank you for coming back to me with this, and my apologies for perhaps not making this clearer, but is there a way by which I can integrate the two because I'd like to include the search the user performed and the username?

Many thanks and kind regards

Chris

0 Karma

woodcock
Esteemed Legend

Get rid of everything after (and including) the | and see what fields are there (there is a username field but I don't recall what the name is).

0 Karma

IRHM73
Motivator

Hi @woodcock that's great.

Kind regards and many thanks.

Chris

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...