Hi
I have SPL like below:
index="myindex" user
| rex field=source "\/data\/(?<product>\w+)\/(?<date>\d+)\/(?<server>\w+)"
| search server=server1
as we know first search "user" work more quickly but second one "server=server1" take long time specially on large data.
is there any way to search "search server=server1" more efficient like "user"?
Thanks
The expression server=server1 requires the server field to exist, which it doesn't until after the rex command runs. You can, however, search for server1 as a string within the source field to reduce the number of events read from the index and filter further on the server field.
index="myindex" user source="data*server1*"
| rex field=source "\/data\/(?<product>\w+)\/(?<date>\d+)\/(?<server>\w+)"
| search server=server1
The expression server=server1 requires the server field to exist, which it doesn't until after the rex command runs. You can, however, search for server1 as a string within the source field to reduce the number of events read from the index and filter further on the server field.
index="myindex" user source="data*server1*"
| rex field=source "\/data\/(?<product>\w+)\/(?<date>\d+)\/(?<server>\w+)"
| search server=server1
@richgalloway this string must be search on source field NOT content of log!
server name not exist in log file, it came from name of log file.
Thanks for the correction (it's virtual Monday for me). See my revised answer.