Skip to main content

QRadar Build Query and Search

This Playbook is part of the IBM QRadar Pack.#

Supported versions

Supported Cortex XSOAR versions: 6.2.0 and later.

The QRadar Build Query and Search playbook creates an AQL query for the QRadar SIEM using the QRadarCreateAQLQuery automation queries. Complex queries take into consideration several inputs and allow including or excluding each of the values as well as performing a full or partial search. Each of the values can be searched across several fields.

The playbook supports 3 separate conditions to be evaluated. For example, in the first condition, inputs will evaluate several user names that may or may not exist in several fields. The second input, can for example, evaluate for IP addresses in several fields that may or may not exist in several fields, and a third value can search for an event ID that may or may not exist in several fields. The results of all of the inputs will create an AQL query that covers all of the inputs combining all of the different conditions.

Each of the inputs is validated so in case the inputs are not set correctly, the user can review and run them again. Also, populated inputs will be combined, meaning by populating the first and second values the resulting AQL query will be a combination of all of the values and not 3 separate searches. In addition, make sure to populate the inputs in order according to the indexed fields in QRadar (indexed fields should be provided before non indexed ones).

Dependencies#

This playbook uses the following sub-playbooks, integrations, and scripts.

Sub-playbooks#

  • QRadar Get Hunting Results

Integrations#

  • QRadar_v3

Scripts#

  • QRadarCreateAQLQuery

Commands#

  • qradar-search-retrieve-events

Playbook Inputs#


NameDescriptionDefault ValueRequired
BaseValuesToSearchThe values of the first field to search. This can be a single value or a comma-separated list of values. For example, admin1,admin2Optional
BaseFieldsToSearchThe field names of the first field to search. This can be a single value or a comma-separated list of values. For example, username,userOptional
BaseFieldStateThe state of the first field to search, meaning whether the values in the field be included or excluded. Valid options are include or exclude.includeOptional
BaseFieldMatchWhether the values of the first field should be an exact match or a partial match. Valid options are exact or partial. When choosing exact, the AQL query will use the = operator. When choosing partial, the AQL query will ILIKE and add '%%' to the values. Notice that if you choose exact you will have to specify the BaseFieldsToSearch as well.exactOptional
FirstAdditionalValuesThe values of the second field to search. This can be a single value or a comma-separated list of values. For example admin1,admin2Optional
FirstAdditionalFieldsThe field names of the second field to search. This can be a single value or a comma-separated list of values. For example admin1,admin2Optional
FirstAdditionalFieldStateThe state of the second field to search, meaning whether the values in the field should be included or excluded. Valid options are include or exclude. Notice that if you choose exact you will have to specify the FirstAdditionalFields as well.includeOptional
FirstAdditionalFieldMatchWhether the values of the second field should be an exact match or a partial match. Valid options are exact or partial.exactOptional
SecondAdditionalValuesThe values of the third field to search. This can be a single value or a comma-separated list of values. For example admin1,admin2Optional
SecondAdditionalFieldsThe field names of the third field to search. This can be a single value or a comma-separated list of values. For example username,userOptional
SecondAdditionalFieldStateThe state of the third field to search, meaning should the values in the field be included or excluded. Valid options are include or exclude.includeOptional
SecondAdditionalFieldMatchShould the values of the third field be an exact match or a partial match. Valid options are exact or partial. When choosing exact, the AQL query will use the = operator. When choosing partial, the AQL query will ILIKE and add '%%' to the values. Notice that if you choose exact you will have to specify the SecondAdditionalFields as well.exactOptional
SelectFieldsThe list of fields to select within the AQL query.
The default fields are
DATEFORMAT(devicetime,'dd-MM-yyyy hh:mm'),LOGSOURCENAME(logsourceid),CATEGORYNAME(category),QIDNAME(qid),sourceip,destinationip,username
DATEFORMAT(devicetime,'dd-MM-yyyy hh:mm'),LOGSOURCENAME(logsourceid),CATEGORYNAME(category),QIDNAME(qid),sourceip,destinationip,usernameOptional
TimeFrameTime frame as used in AQL.
For example:
LAST 7 DAYS
START '2019-09-25 15:51' STOP '2019-09-25 17:51'
For more examples, see IBM's AQL documentation.
LAST 1 HOURSOptional
UseHuntingResultsThe QRadar Get Hunting Results playbook outputs the detected hosts, users, and IP addresses detected in the QRadar search results.falseOptional

Playbook Outputs#


PathDescriptionType
QRadar.SearchEventsThe result of the search.string
QRadar.DetectedUsersUsers detected based on the username field in your search.string
QRadar.DetectedInternalIPsInternal IP addresses detected based on fields and inputs in your search.string
QRadar.DetectedExternalIPsExternal IP addresses detected based on fields and inputs in your search.string
QRadar.DetectedInternalHostsInternal host names detected based on hosts in your assets table. Note that the data accuracy depends on how the asset mapping is configured in QRadar.string
QRadar.DetectedExternalHostsExternal host names detected based on hosts in your assets table. Note that the data accuracy depends on how the asset mapping is configured in QRadar.string

Playbook Image#


QRadar Build Query and Search