Splunk Search

How to list result data

gijoesplunk
New Member

Hi, i have a result data like:
host dest_ip src_ip
FW1 192.168.10.1 172.16.20.1
FW1 192.168.10.2 172.16.20.2
FW1 192.168.10.3 172.16.20.3
FW2 192.168.10.4 172.16.20.4
FW2 192.168.10.5 172.16.20.5
FW3 192.168.10.6 172.16.20.6

i want to list or get result data like:
FW1
FW2
FW3

Please advice the syntax to obtain datat like above.
I have tried using: "myquery..... | stats values(host) " but the result was like this:
FW1
FW1
FW1
FW2
FW2
FW3

0 Karma

gijoesplunk
New Member

thank's for the all answer.
But now i would like to ask something different, if the "host" contains time&date like this one:
host

Oct 13 16:59:03 FW1
Oct 13 16:59:03 FW1
Oct 13 16:59:04 FW1
Oct 13 16:59:04 FW2
Oct 13 16:59:05 FW2
Oct 13 16:59:06 FW3

how can i get info only:
FW1
FW2
FW3

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Hosts should be in separate fields from the timestamps. Then the same answers as above apply. If they are not in separate fields, you should separate them before doing anything else. Use rex or the field extractor to separate host names from timestamps.

---
If this reply helps you, Karma would be appreciated.
0 Karma

sundareshr
Legend

Try stats count by host | fields host *OR* dedup host | table host

0 Karma

gijoesplunk
New Member

thank's for all the answer,
but now i would like to ask a bit different, if the host contain date and time like:
Oct 13 16:59:03 FW1
Oct 13 16:59:03 FW1
Oct 13 16:59:04 FW1
Oct 13 16:59:04 FW2
Oct 13 16:59:05 FW2
Oct 13 16:59:06 FW3

How can i get result only like this:
FW1
FW2
FW3

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try stats list(host).

---
If this reply helps you, Karma would be appreciated.
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 ...