Search and DQL¶
ANALYST WORK > Search queries the events of every data source you can see with DQL, DRACO's query language: a filter, then optional stages separated by |, in the style of Splunk's SPL.
The page¶
- Type a query, pick a range (
-15m,-24h,-7d,-2w, or exact times) and press Run (or Ctrl/Cmd+Enter). The query and range are in the URL, so a search can be shared. - The histogram shows events over time; click a bar or drag over bars to zoom.
- The fields list shows the fields of the returned events with their top values; click a value to add
field=value, the minus icon to addfield!=value. - Expand an event to see every field and the raw line, add or exclude a value, search a value everywhere, add a value to threat intel, or open the resource and its failing findings.
- Table results (from
stats,timechart,top...) sort by column and chart as lines or bars. - Saved searches (private or shared with the organization, pinnable), Save, History (your last 100 searches), Export CSV (up to 100,000 rows), Open as detection (the query becomes a detection rule), Schedule report and Ask AI Assistant (writes or explains DQL).
A search returns up to 1,000 events per page; the total is counted up to 1,000,000 (shown as an estimate above that).
Filters¶
source=nginx* status>=500 src_ip=203.0.113.* # data source name, comparisons, wildcards
source_type=cloudflare_security_events action=block # connector type
"login failed" NOT user IN (root, admin) # phrases, IN, NOT
(action=ConsoleLogin OR action=AssumeRole) status=failure
field=* # the field exists
- Operators:
=,!=,<,<=,>,>=,*wildcards,IN (...), quoted phrases,AND,OR,NOTand parentheses.ORbinds tighter thanAND, as in Splunk; use parentheses when in doubt. - Exact matches are case-sensitive; wildcards are not.
source=matches data source names (case-insensitive) andsource_type=the connector type.- Normalized fields (
src_ip,dst_ip,actor_user,action,status,host,url,user_agent,resource_uid,cloud_account,class_uid,severity_id...) are columns; anything else is a path in the parsed fields, such asfields.geo.countryor simplygeo.country. - Columns computed at ingest:
geo_country(country code ofsrc_ip),geo_asn,asn_class(cloud,hosting,vpn,mobile,tor,residential),ua_family(browser:chrome,cli:aws-cli,sdk:boto3, ...) andua_os. The full geolocation is infields.geoandfields.asn. #starts a comment.
Stages¶
| Stage | Example | Does |
|---|---|---|
where |
| where status >= 500 AND len(url) > 20 |
keeps matching rows (expressions and functions) |
stats |
| stats count, dc(src_ip) as ips by host |
aggregates (count, dc, sum, avg, min, max, p95, values...) |
timechart |
| timechart span=1h count by action |
one row per time bucket and value |
top / rare |
| top limit=5 src_ip |
most / least common values |
table / fields |
| table ts, src_ip, url / | fields - raw |
chooses columns |
sort |
| sort -count |
orders (- descending) |
head |
| head 20 |
first rows |
dedup |
| dedup src_ip |
first row per value |
rename |
| rename src_ip as client |
renames columns |
eval |
| eval kb = round(bytes / 1024, 1) |
computes columns |
rex |
| rex field=url "^/api/(?<api>\w+)" |
extracts fields at search time |
lookup |
| lookup tor_exit_nodes src_ip OUTPUT is_tor |
adds columns from a lookup table |
iocmatch |
| iocmatch src_ip, url min_confidence=50 |
keeps events matching threat intel indicators |
anomalies |
| anomalies actor_user min_score=50 days=7 detector=first_seen |
keeps events of entities with open behaviour anomalies and adds anomaly_count, anomaly_max_score, anomaly_detectors |
The editor completes field names, stages, functions and lookup names; when a query fails, the error is underlined at its position until you edit the query. The dashboard panel editor checks a query without running it (API: POST /api/v1/xdr/search/validate).
Examples¶
# Failed console sign-ins per user and country, last 24 hours
source_type=aws_cloudtrail action=ConsoleLogin status=failure
| stats count by actor_user, fields.geo.country | sort -count
# Requests from Tor exit nodes
source=nginx* | lookup tor_exit_nodes src_ip OUTPUT is_tor | where is_tor = true
# What did people with a behaviour anomaly do today?
source_type=aws_cloudtrail | anomalies actor_user min_score=40
| stats count by actor_user, anomaly_detectors, action | sort -count
# Okta sign-ins from more than three countries per user
source_type=okta_system_log class_uid=3002
| stats dc(fields.geo.country) as countries by actor_user | where countries > 3
Limits¶
Queries run with time, memory and row limits per organization (a query cannot raise them), and an hourly quota of queries, rows read and query time. Over the quota, Search answers "query quota exceeded" with the reset time; Settings > Log processing > Storage & retention shows this hour's use. Narrow the range or the filter when a query hits a limit.