Iniciar sesión

Ranges, dates and IP networks

10 min · 2 ejercicio(s)

Numeric ranges

Use >, >=, < and <= for numbers:

http.response.status_code >= 500
source.bytes > 10000000

Dates

Date fields accept dates and date math. Quote the value:

@timestamp >= "2026-03-12" and @timestamp < "2026-03-13"
@timestamp > "now-24h"

In Kibana you usually set the time with the time picker, but explicit ranges are useful in saved queries.

IP fields and CIDR

Fields of type ip understand CIDR notation:

source.ip: 10.0.0.0/8
not destination.ip: (10.0.0.0/8 or 172.16.0.0/12 or 192.168.0.0/16)

The second line is a classic: everything that leaves the private address ranges.

🔎 Profundiza: funciones, errores habituales y práctica

Range operators

Operator Meaning Works on
> >= greater (or equal) numbers, dates, IPs, keywords (alphabetically)
< <= smaller (or equal) same

Combine two ranges with and for an interval: destination.port >= 1024 and destination.port <= 49151.

Date math

Expression Meaning
now-15m 15 minutes ago
now-1d/d yesterday, rounded down to midnight
"2026-03-12T10:00:00" an absolute time (UTC unless the data view uses another time zone)

CIDR on IP fields

source.ip: 10.0.0.0/8 only works on fields mapped as ip. On a keyword field CIDR notation is just text and won't match. Check the type in the field list.

Private ranges you should know: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, loopback 127.0.0.0/8, link-local 169.254.0.0/16, and for IPv6 fc00::/7 and ::1.

Thresholds are a starting point

"More than 50 MB" is a hypothesis, not a rule. Before you turn a threshold into an alert, check the distribution in your environment, e.g. with ES|QL STATS PERCENTILE(source.bytes, 99), so the threshold is above normal behaviour.

Ejercicios prácticos de esta lección

Resuelve estos ejercicios con una consulta en el laboratorio Elasticsearch real. Inicia sesión gratis para acceder al laboratorio, las pistas y la corrección automática.

  1. 1. Big transfers

    How many network events in lab-endpoint sent at least 50,000,000 bytes (source.bytes)?

  2. 2. Big transfers to the internet

    Some of these transfers are the nightly backup to an internal server. Write a query that only returns transfers of at least 50,000,000 bytes to destinations outside 10.0.0.0/8.