Skip to main content

Elasticsearch & Kibana v8 Search Cheat Sheet

Shenzhen, China

Kibana Query Language (KQL)

TaskQuery
Find NGINX error log entriesevent.dataset:*error
Return results for IP1 or IP2 using Free Text Search`event.dataset : nginx.error and (46.231.239.5
Find entries that don't specify a user agentNOT user_agent.name : *
Find HTTP Status Codes that are not successful*http.response.status_code > 299

* HTTP Response Codes

  • Informational responses: 100199
  • Successful responses: 200299
  • Redirection messages: 300399
  • Client error responses: 400499
  • Server error responses: 500599


Elastic Kibana v8



TaskQuery
Get all NGINX connections that have an HTTP status code between 500 and 599 and originate in a specific regionsource.geo.country_iso_code: RU and http.response.status_code >= 500
Get all NGINX connections that originated from one of two locationssource.geo.country_iso_code: RU or source.geo.country_iso_code: CN
Check Zabbix-Agent Health Checksource.ip : 127.0.0.1 and traefik.access.user_agent.original : Zabbix 6.0.0beta2


Elastic Kibana v8



TaskQuery
Search for a source by IP addresssource.ip : 118.184.177.30
Expand the IP range using CIDR notationsource.ip : 118.184.177.0/24
Expand the IP range using CIDR notationsource.ip : 118.184.0.0/16
Expand the IP range using CIDR notationsource.ip : 118.0.0.0/8
Search for IPv6 rangessource.ip : "fe80::/64"
Searching for nested valuesdata:{point1 > 100 and point2: 1}

Lucene Query Language

Deactivate KQL in the Kibana Discover tab to activate the Lucene Query Syntax.

TaskQuery
Return results for IP1 or IP2 using Free Text Search61.231.239.5 45.201.198.232
Return results for IP1 or IP2 using Free Text Search`61.231.239.5
Return results for an IP and a specific URL45.201.198.232 AND \/dr\/update_magento.php
Return results for an IP and a specific URL45.201.198.232 && "/dr/update_magento.php"
Return results for an IP and a specific URL+45.201.198.232 +\/dr\/update_magento.php
Remove all health check requests from resultsagent.name : ticketsystem NOT traefik.access.user_agent.original : "Zabbix 6.0.0"
Has a specific IP accessed without an error+45.201.198.232 -error
Has a specific IP accessed without success45.201.198.232 NOT success
Has a specific IP accessed without success45.201.198.232 !success
Use grouped queries(user_agent.version: <2.20 AND event.category: web) AND (agent.type: filebeat !agent.version: 7.9.0)
Use Proximity Search distance threshold when terms are separated"forbidden 5.9.61.232" ~2


Elastic Kibana v8



TaskQuery
Use Wildcardsagent.ephemeral_id:b59445f4-*
Inclusive Range Queriesuser_agent.version:[1.0 TO 1.1]
Exclusive Range Querieshttp.response.status_code:{299 TO 500}
Mixed Range Queries{1.0 TO 1.1]
Use Wildcards with Range Queriesdestination.port:[80 TO *]
Check if field Exists_exists_ : agent.hostname
Check if field not ExistsNOT _exists_ : agent.hostname
Use Fuzzy Searches to get around typos or mal-formatted termsurl.path:\/16-mm-w-o-ir-filter-1523.ht~2
Use Fuzzy Searches all sub-versions of an agentagent.version:8.0~2
Boost term weightsdestination.port:(9200^9 OR 443)
Use Regex to find all single lower case characters and numbers from 0 to 9/[a-z0-9]/
Regex for valid IPv4 addresses*/(([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+))/
Regex for valid, private IPv4 addresses`/(^10.)
Regex to find all versions between 7 and 8agent.version:/[7-8]\.[0-9]\.[0-9]/

* The expressions above are not displayed correctly - check regexlib.com for Regex. Replace leading ^ and trailing $ with /