Security

Splunk query leveraging TA-user-agents runs extremely long

beetlegeuse
Path Finder

I have version 1.76 of the TA-user-agents app installed on my search head for use with searching against web access logs; to prepare for this, I created a field extraction called "http_user_agent" to extract a string similar to this:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15

When I run the following search over a 15 minute timeframe in Fast Mode...

 

index=foo source=*access* sourcetype=bar 
| lookup user_agents http_user_agent 
| search ua_family="Safari" ua_os_family="Mac OS X" 
| eval browserOS = ua_family . ":" . ua_os_family 
| timechart count by browserOS limit=0

 

...I find that it takes what seems to be a VERY long time to complete (446 seconds to search through 418,000 events). If I just run the base search without the "lookup", "search", "eval" and "timechart", it takes 3.3 seconds to execute against the same number of events.

Is this expected behavior for the TA, or is my search not optimized correctly? 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

It probably is an expected performance. See the Job Inspect details to see which step is most time-consuming and which produces which number of results.

One easy thing for possible improvement is limiting your search scope. For now you're doing lookup on every single event from your timerange. It could speed up your search a little if you can limit your number of events early - if you're expecting the word "Safari" in your ecents, filter early - look for Safari in the first step.

But it might simply be that it's the aggregation at the end that takes most of the time. In that case you can't do much.

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!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...