I am trying to get a subsearch to return a single value which represents an IP address and I am getting an error "Error in 'eval' command: the number (ip address) is invalid"
eval a=
[ search index=pan sourcetype=pan:traffic dest_port=22
| stats count as c by src_ip
| sort - c
| head 1|return $src_ip]
any ideas?
Add format clause
eval a=
[ search index=pan sourcetype=pan:traffic dest_port=22
| stats count as c by src_ip
| sort - c
| head 1|return $src_ip|format]
Add format clause
eval a=
[ search index=pan sourcetype=pan:traffic dest_port=22
| stats count as c by src_ip
| sort - c
| head 1|return $src_ip|format]
thanks, this is cleaner than my solution!
ok I fixed it myself, you have to add quotes to it.
eval a=
[ search index=pan sourcetype=pan:traffic dest_port=22
| stats count as c by src_ip
| sort - c
| head 1|eval a="\""+src_ip+"\""|return $a]