Building search queries
Build custom queries to get specific results so that you find information that is relevant to you. Create custom queries in Data Explorer to easily find indicators of compromise. Use the query builder to construct and submit STIX-compliant queries to your connected data sources. If you configured IBM® QRadar as a data source, you can also construct and submit Ariel Query Language (AQL) queries.
STIX query
Although STIX 2 is gaining recognition as an industry standard, it is not yet widely known to all security professionals. The query builder helps you to create a search query for IBM Prerequisite Scanner, URLs, MD5 hashes, and more.
About this task
To learn more about STIX 2, see Introduction to STIX 2.
To learn more about the STIX 2 language that the query builder supports, see STIX 2 Patterning specifications.
- If you receive the message “The cluster is busy processing other requests and does not respond to your queries,” wait a few minutes and try again.
- When you use the Visual Builder, you must press Enter after you type the value. You can also press Enter and Shift to add multiple values.
Procedure
Results
When a query is run, an 'active-query' card is added. Each query expires 14 days after it is created.
For sample queries, see STIX queries.
AQL query
The Ariel Query Language (AQL) is a structured query language that you use to query and manipulate event and flow data from the Ariel database in IBM QRadar.
About this task
To learn more about AQL, see Ariel Query Language.
- If you receive the message “The cluster is busy processing other requests and does not respond to your queries,” wait a few minutes and try again.
- When you use the Visual Builder, you must press Enter after you type the value. You can also press Enter and Shift to add multiple values.
Procedure
Results
When a query is run, an 'active-query' card is added. Each query expires 14 days after it is created.
For sample queries, see AQL queries.
Sample queries
Use the following sample search queries as a guide to refine search results to better meet your needs.
STIX queries
Search for IPv4
If a timeframe is not specified, a default timeframe is applied according to the data source setting.
[ipv4-addr:value = '127.0.0.1']
Search for URL with timeframe
Note that the START and STOP times are outside of the query string brackets
([]
).
[url:value = 'www.ibm.com'] START t'2019-03-23T13:53:12.229Z' STOP
t'2019-03-26T13:53:27.170Z'
Search for Destination Ports other than port 443
Exclude (!=
) values to narrow your results.
[network-traffic:dst_port != 443]
Search for the Powershell process that includes Mimikatz
in the command
line
Use operators such as LIKE
and IN
. Use %
to
represent "wild" strings.
[process:name = 'powershell.exe' AND process:command_line LIKE
'%Mimikatz%']
Search for the process that matches TSTheme.exe
and parent process that
includes svchost.exe
and MD5
hash
Group strings with parentheses ()
.
([process:name MATCHES 'TSTheme.exe' AND process:parent_ref.name LIKE '%svchost.exe']
AND [file:hashes.'MD5' = 'C9A51BDEC4B4E0B6EF51B64637677D14'])
For more information, see STIX Patterning, Examples.
AQL queries
Returns all the fields from the events table that were sent in the last 10 minutes.
SELECT * FROM events LAST 10 MINUTES
Returns the sourceip
and destinationip
from the events table
that were sent in the last 24 hours.
SELECT sourceip,destinationip FROM events LAST 24 HOURS
Returns all the fields from the events table during that time interval.
SELECT * FROM events START '2021 01 01 9:00:00' STOP '2021 01 01
10:20:00'
Returns all the fields in the events table sent in the last 24 hours, sorting the output from highest to lowest magnitude.
SELECT * FROM events ORDER BY magnitude DESC LAST 24 HOURS
Returns all the fields from the events table that have the specified text in the output.
SELECT * FROM events WHERE TEXT SEARCH 'firewall'
For more information, see Sample AQL queries.