Use the LIKE operator or phrase search to query logs that contain an exact sequence of keywords.
Sample log
body_bytes_sent:1061
http_user_agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5
remote_addr:192.0.2.2
remote_user:vd_yw
request_method:DELETE
request_uri:/request/path-1/file-5
status:207
time_local:10/Jun/2021:19:10:59
Query requirement
Find logs where the http_user_agent field contains like Gecko.
Examples
The following examples use the sample log and query requirement above.
Phrase search
Use a phrase query to match an exact phrase.
http_user_agent:#"like Gecko"
LIKE syntax
The LIKE operator follows standard SQL LIKE syntax. The percent sign (%) matches zero or more characters. The underscore (_) matches a single character.
-
Correct query statement
* | Select * where http_user_agent like '%like Gecko%'http_user_agent is a log field.
-
Incorrect query statement
This query does not perform an exact match. Results include logs containing
like Gecko,Gecko like,like abc Gecko, andGecko abc like."like" and "Gecko"
该文章对您有帮助吗?