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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...