Splunk Search

Is there any way to optimize this query to increase performance?

shafee_anwar
New Member

We are trying to create a query to get list of fields in all sourcetypes grouped by sourcetype and index. 

We tried to use following query but it's performance is very slow. 

| tstats count WHERE index IN(main,_introspection) GROUPBY index, sourcetype
| rename index AS indexname, sourcetype AS sourcetypename
| map maxsearches=100 search="| search index=\"$indexname$\" sourcetype=\"$sourcetypename$\" | head 1|fieldsummary | eval index=\"$indexname$\", sourcetype=\"$sourcetypename$\" | WHERE NOT isnull(mean) | fields index, sourcetype, field"

Since there can be any number of sourcetypes(350+ for index=main), maxsearches cannot be set to such a high number.

Is there any way to optimize this query to increase performance or any other query that will do the job without any performance lag?

Labels (1)
Tags (1)
0 Karma
Get Updates on the Splunk Community!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

New Release | Splunk Cloud Platform 10.1.2507

Hello Splunk Community!We are thrilled to announce the General Availability of Splunk Cloud Platform 10.1.2507 ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

🗣 You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...