Splunk Search

How to filter columns in a search query splunk

mahbs
Path Finder

Hi Guys,

I have a simple question. I have a search query, and it basically outputs lots of fields. Is there a way of filter for a specific column in the search query?

index=xxx sourcetype=xxx host=xxx OR host=xxx| eval UNIQUE=toString(xx)| eventstats dc(host) as ID by UNIQUE | where ID=2 | eval raw=toString(YYYY)| stats values(host) AS hosts BY raw | where mvcount(hosts) = 1 | replace xxx with xxx, xxx with xxxin hosts

Kind Regards
Mahbs

Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi mahbs,
you can use the table command ( https://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/Table ) to display only the requested fields or fields - fieldname ( https://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/Fields ) to hide some column.
Bye.
Giuseppe

cmerriman
Super Champion

or to add onto this, use the fields field1 field2.... to show fields, instead of the table command

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi

Have you tried fields command ?

eg.
... | fields host, ip | fields - _*

Doc: http://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/Fields

Thanks

0 Karma
Get Updates on the Splunk Community!

Enhance Your Splunk App Development: New Tools & Support

UCC FrameworkAdd-on Builder has been around for quite some time. It helps build Splunk apps faster, but it ...

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...