Is it possible to have ip addresses in a search resolved to a host name and displayed in the results rather then the ip address. My search is:
source="udp:514" "dst=192.168." | stats count by dst | sort -count limit=10
This gives me the top ten hit ip addresses. I would like to see the host name rather than (or as well as) the ip address. Can this be done as part of the search string?
Yes. But you will need a lookup table that matches the IP address to the host name.
Depending on the apps you have installed, you may find that this lookup table already exists. If it does already exist you will find it in the lookup folder, and it will automatically populate a field in which case you simply need to add the field to your stats. The name of the field escapes me.
Actually, the answers entries I linked to are for using an external command that performs the lookup on the fly and responds with the results.
There is no need to create a lookup table as long as the nameserver holds those records. Just use the following after your example search:
<search> | lookup dnslookup clientip as dst OUTPUT clienthost as DST_RESOLVED
this query has worked for me "lookup dnslookup clientip as lsp_rro OUTPUT clienthost as hops" when trying to make a human readable LSP path. We use /etc/hosts for the IP to hostname lookup, you can also use a DNS server to fill this requirement such as BIND9, MS Server or dnsmasq to name a few.