Splunk Search

How can I optimize my search?

Deepali529
Explorer

This search is taking too much time to execute, around 20 mins. Is it because of the lookup?

index="access_log_index" sourcetype="access_log" | rename agent as http_user_agent | lookup user_agents http_user_agent | stats count by  ua_os_family | rename ua_os_family as os_type

How can I optimize my search? Any suggestions will be appreciated.
Thanks

0 Karma
1 Solution

skoelpin
SplunkTrust
SplunkTrust

You should look at the job inspector and see where most of the time is being spent

https://docs.splunk.com/Documentation/Splunk/6.5.0/Search/ViewsearchjobpropertieswiththeJobInspector

How big is your lookup table?

View solution in original post

skoelpin
SplunkTrust
SplunkTrust

You should look at the job inspector and see where most of the time is being spent

https://docs.splunk.com/Documentation/Splunk/6.5.0/Search/ViewsearchjobpropertieswiththeJobInspector

How big is your lookup table?

Deepali529
Explorer

Thanks skoelpin 🙂
It reduces the execution time of query from 816 seconds to 28 seconds

Deepali529
Explorer

It's quite large lookup. I want to find the OS types so installed TA_user_agents add-on. Lookup is present in it

0 Karma

skoelpin
SplunkTrust
SplunkTrust

"quite large" can be relative.. If your lookup is as massive as you claim then you could always use a case statement to match on rather than a lookup table.. It should be faster but you can test this by creating a simple match case and run it over a small time frame then look at the job inspector to see how long it took. Then run the same sample over the lookup and see how long that took

... | eval os = case(match(useragent,"Windows .. 5\.1"),"Windows XP",match(useragent,"droid"),"Android",match(useragent,"Windows NT 6.1"),"Windows 7") | eval browser = case(match(useragent,"MSIE 10.0"),"Internet Explorer 10.0",match(useragent,"Chrome"),"Chrome",match(useragent,"Safari/"),"Safari") | eval arch = case(match(useragent,"droid"),"android",match(useragent,"iPad"),"ipad",match(useragent,"iPod"),"ipod")
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...