Splunk Search
Highlighted

How to list result data

New Member

Hi, i have a result data like:
host destip srcip
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
Highlighted

Re: How to list result data

SplunkTrust
SplunkTrust

Try stats list(host).

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

Re: How to list result data

Legend

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

0 Karma
Highlighted

Re: How to list result data

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
Highlighted

Re: How to list result data

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
Highlighted

Re: How to list result data

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, an upvote would be appreciated.
0 Karma