Splunk Search

How to list fields, values and also index and source names using fieldsummary

chanmic
New Member

Hi All,

I need to look for specific fields in all my indexes. Using fieldsummary, I am able to get a listing of my specific fields, count, distinct_count and values, but I also like to add 2 new columns so it would also give the index and the source names.

Is there a way to do this with fieldsummary or would there be an alternatively.

Thanks.

Labels (1)
0 Karma
1 Solution

javiergn
SplunkTrust
SplunkTrust

See if the following helps and run it against last 24 hours or less if possible (careful as it will be a bit slow):

| tstats count WHERE index=* GROUPBY index, sourcetype
| fields - count
| rename index AS indexname, sourcetype AS sourcetypename
| map maxsearches=5 search="| search index=\"$indexname$\" sourcetype=\"$sourcetypename$\" | head 100 | fieldsummary | eval index=\"$indexname$\", sourcetype=\"$sourcetypename$\" | fields index, sourcetype, *"

You can play with the maxsearches value to match your needs once you have the final version as it can't be unlimited I'm afraid.
If you want the source instead of the sourcetype simply replace it in the query above.

View solution in original post

javiergn
SplunkTrust
SplunkTrust

See if the following helps and run it against last 24 hours or less if possible (careful as it will be a bit slow):

| tstats count WHERE index=* GROUPBY index, sourcetype
| fields - count
| rename index AS indexname, sourcetype AS sourcetypename
| map maxsearches=5 search="| search index=\"$indexname$\" sourcetype=\"$sourcetypename$\" | head 100 | fieldsummary | eval index=\"$indexname$\", sourcetype=\"$sourcetypename$\" | fields index, sourcetype, *"

You can play with the maxsearches value to match your needs once you have the final version as it can't be unlimited I'm afraid.
If you want the source instead of the sourcetype simply replace it in the query above.

chanmic
New Member

Thanks Javiergn

0 Karma

AishBhardwaj
New Member

Is there a way to get difference in two searches using the above search?
Basically I am trying to see the difference in fields today from yesterday and I also want to display the source name and index.
I can easily find the difference but I can’t display the index name and source name with it. The above query seems to serve the purpose but I can’t figure out how to use this in my case. Any help appreciated.

0 Karma

to4kawa
Ultra Champion

please ask by another question and provide sample query.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...