Hi - I wish to use a wildcard in the where clause in the below query can someone help?
index=whatever* sourcetype=server
|rex field=CLIENT_VERSION "\'(?P.+)\'"
|table version
|where version=*10_2*
here the value in the version field is FS_10_2_17387/FS_10_2_12387/FS_10_2_17987
Hi alladin101,
it's me again 🙂
Now I get it; no this is not the way you use where
. If you use where
you will compare two fields and their respective values. You would have to use search
because this will search using the value of the field.
like this:
index=whatever* sourcetype=server
|rex field=CLIENT_VERSION "\'(?P.+)\'"
|table version
|search version=*10_2*
hope this helps...
cheers, MuS
Hi alladin101,
it's me again 🙂
Now I get it; no this is not the way you use where
. If you use where
you will compare two fields and their respective values. You would have to use search
because this will search using the value of the field.
like this:
index=whatever* sourcetype=server
|rex field=CLIENT_VERSION "\'(?P.+)\'"
|table version
|search version=*10_2*
hope this helps...
cheers, MuS
hi,
if i want to add multiple values in the version field, can i use "AND" operator in search command?
for eg: | search version= 10 AND 12 AND 13
or how to include all three values in version field?
How about this?
.... | search version="10" version="12" version="13"
FYI - the optimizer will combine this into search(index=whatever* sourcetype=server version=*10_2*)
, as if it was part of the original search query.
Yes, this is the difference between using where
and search
; search
can be basically used in the base/original search where as where
will compare/eval values of fields ... even back in 2014 😉
cheers, MuS
This just saved my life! Thanks!
Hi Mus,
Thanks for the answer 🙂
can i use this as well?
|where like(version,"%FX_10_2%")
yes, this should work as well