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!

Dashboard Studio Challenge - Learn New Tricks, Showcase Your Skills, and Win Prizes!

Reimagine what you can do with your dashboards. Dashboard Studio is Splunk’s newest dashboard builder to ...

Introducing Edge Processor: Next Gen Data Transformation

We get it - not only can it take a lot of time, money and resources to get data into Splunk, but it also takes ...

Take the 2021 Splunk Career Survey for $50 in Amazon Cash

Help us learn about how Splunk has impacted your career by taking the 2021 Splunk Career Survey. Last year’s ...