Alerts - CrowdStrike/falconpy GitHub Wiki
Operation ID | Description | ||||
---|---|---|---|---|---|
|
Retrieve aggregates for alerts across all CIDs. | ||||
|
Retrieve aggregates for alerts across all CIDs. | ||||
|
Perform actions on alerts identified by alert ID(s) in request. | ||||
|
Perform actions on alerts identified by alert ID(s) in request. | ||||
|
Retrieve all alerts given their IDs. | ||||
|
Retrieve all alerts given their IDs. | ||||
|
Search for alert IDs that match a given query. | ||||
|
Search for alert IDs that match a given query. |
WARNING
client_id
andclient_secret
are keyword arguments that contain your CrowdStrike API credentials. Please note that all examples below do not hard code these values. (These values are ingested as strings.)CrowdStrike does not recommend hard coding API credentials or customer identifiers within source code.
Get alert aggregates as specified via json in request body.
get_aggregate_alerts_v1 (or get_aggregate_alerts)
Method | Route |
---|---|
/alerts/aggregates/alerts/v1 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body |
|
|
body | list of dictionaries | Full body payload in JSON format. |
date_ranges |
|
|
body | list of dictionaries | Applies to date_range aggregations. Example: [ { "from": "2016-05-28T09:00:31Z", "to": "2016-05-30T09:00:31Z" }, { "from": "2016-06-01T09:00:31Z", "to": "2016-06-10T09:00:31Z" } ] |
exclude |
|
|
body | string | Elements to exclude. |
field |
|
|
body | string | The field on which to compute the aggregation. |
filter |
|
|
body | string | FQL syntax formatted string to use to filter the results. |
from |
|
|
body | integer | Starting position. |
include |
|
|
body | string | Elements to include. |
interval |
|
|
body | string | Time interval for date histogram aggregations. Valid values include:
|
max_doc_count |
|
|
body | integer | Only return buckets if values are less than or equal to the value here. |
min_doc_count |
|
|
body | integer | Only return buckets if values are greater than or equal to the value here. |
missing |
|
|
body | string | Missing is the value to be used when the aggregation field is missing from the object. In other words, the missing parameter defines how documents that are missing a value should be treated. By default they will be ignored, but it is also possible to treat them as if they had a value. |
name |
|
|
body | string | Name of the aggregate query, as chosen by the user. Used to identify the results returned to you. |
q |
|
|
body | string | Full text search across all metadata fields. |
ranges |
|
|
body | list of dictionaries | Applies to range aggregations. Ranges values will depend on field. For example, if max_severity is used, ranges might look like: [ { "From": 0, "To": 70 }, { "From": 70, "To": 100 } ] |
size |
|
|
body | integer | The max number of term buckets to be returned. |
sub_aggregates |
|
|
body | list of dictionaries | A nested aggregation, such as: [ { "name": "max_first_behavior", "type": "max", "field": "first_behavior" } ] There is a maximum of 3 nested aggregations per request. |
sort |
|
|
body | string |
FQL syntax string to sort bucket results.
asc and desc using | format. Example: _count|desc
|
time_zone |
|
|
body | string | Time zone for bucket results. |
type |
|
|
body | string | Type of aggregation. Valid values include:
|
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
date_range = {
"from": "string",
"to": "string"
}
search_range = {
"From": integer,
"To": integer
}
response = falcon.get_aggregate_alerts_v1(date_ranges=[date_range],
exclude="string",
field="string",
filter="string",
from=integer,
include="string",
interval="string",
max_doc_count=integer,
min_doc_count=integer,
missing="string",
name="string",
q="string",
ranges=[search_range],
size=integer,
sort="string",
time_zone="string",
type="string"
)
print(response)
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
date_range = {
"from": "string",
"to": "string"
}
search_range = {
"From": integer,
"To": integer
}
response = falcon.PostAggregatesAlertsV1(date_ranges=[date_range],
exclude="string",
field="string",
filter="string",
from=integer,
include="string",
interval="string",
max_doc_count=integer,
min_doc_count=integer,
missing="string",
name="string",
q="string",
ranges=[search_range],
size=integer,
sort="string",
time_zone="string",
type="string"
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
BODY = [{
"date_ranges": [
{
"from": "string",
"to": "string"
}
],
"exclude": "string",
"field": "string",
"filter": "string",
"from": integer,
"include": "string",
"interval": "string",
"max_doc_count": integer,
"min_doc_count": integer,
"missing": "string",
"name": "string",
"q": "string",
"ranges": [
{
"From": integer,
"To": integer
}
],
"size": integer,
"sort": "string",
"sub_aggregates": [
null
]
"time_zone": "string",
"type": "string"
}]
response = falcon.command("PostAggregatesAlertsV1", body=BODY)
print(response)
Get alert aggregates as specified via json in request body.
get_aggregate_alerts_v2
Method | Route |
---|---|
/alerts/aggregates/alerts/v2 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body |
|
|
body | list of dictionaries | Full body payload in JSON format. |
date_ranges |
|
|
body | list of dictionaries | Applies to date_range aggregations. Example: [ { "from": "2016-05-28T09:00:31Z", "to": "2016-05-30T09:00:31Z" }, { "from": "2016-06-01T09:00:31Z", "to": "2016-06-10T09:00:31Z" } ] |
exclude |
|
|
body | string | Elements to exclude. |
field |
|
|
body | string | The field on which to compute the aggregation. |
filter |
|
|
body | string | FQL syntax formatted string to use to filter the results. |
from |
|
|
body | integer | Starting position. |
include |
|
|
body | string | Elements to include. |
include_hidden |
|
|
query | string | Allows previously hidden alerts to be retrieved. |
interval |
|
|
body | string | Time interval for date histogram aggregations. Valid values include:
|
max_doc_count |
|
|
body | integer | Only return buckets if values are less than or equal to the value here. |
min_doc_count |
|
|
body | integer | Only return buckets if values are greater than or equal to the value here. |
missing |
|
|
body | string | Missing is the value to be used when the aggregation field is missing from the object. In other words, the missing parameter defines how documents that are missing a value should be treated. By default they will be ignored, but it is also possible to treat them as if they had a value. |
name |
|
|
body | string | Name of the aggregate query, as chosen by the user. Used to identify the results returned to you. |
q |
|
|
body | string | Full text search across all metadata fields. |
ranges |
|
|
body | list of dictionaries | Applies to range aggregations. Ranges values will depend on field. For example, if max_severity is used, ranges might look like: [ { "From": 0, "To": 70 }, { "From": 70, "To": 100 } ] |
size |
|
|
body | integer | The max number of term buckets to be returned. |
sub_aggregates |
|
|
body | list of dictionaries | A nested aggregation, such as: [ { "name": "max_first_behavior", "type": "max", "field": "first_behavior" } ] There is a maximum of 3 nested aggregations per request. |
sort |
|
|
body | string |
FQL syntax string to sort bucket results.
asc and desc using | format. Example: _count|desc
|
time_zone |
|
|
body | string | Time zone for bucket results. |
type |
|
|
body | string | Type of aggregation. Valid values include:
|
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
date_range = {
"from": "string",
"to": "string"
}
search_range = {
"From": integer,
"To": integer
}
response = falcon.get_aggregate_alerts_v2(date_ranges=[date_range],
exclude="string",
field="string",
filter="string",
from=integer,
include="string",
include_hidden=boolean,
interval="string",
max_doc_count=integer,
min_doc_count=integer,
missing="string",
name="string",
q="string",
ranges=[search_range],
size=integer,
sort="string",
time_zone="string",
type="string"
)
print(response)
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
date_range = {
"from": "string",
"to": "string"
}
search_range = {
"From": integer,
"To": integer
}
response = falcon.PostAggregatesAlertsV2(date_ranges=[date_range],
exclude="string",
field="string",
filter="string",
from=integer,
include="string",
include_hidden=boolean,
interval="string",
max_doc_count=integer,
min_doc_count=integer,
missing="string",
name="string",
q="string",
ranges=[search_range],
size=integer,
sort="string",
time_zone="string",
type="string"
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
BODY = [{
"date_ranges": [
{
"from": "string",
"to": "string"
}
],
"exclude": "string",
"field": "string",
"filter": "string",
"from": integer,
"include": "string",
"interval": "string",
"max_doc_count": integer,
"min_doc_count": integer,
"missing": "string",
"name": "string",
"q": "string",
"ranges": [
{
"From": integer,
"To": integer
}
],
"size": integer,
"sort": "string",
"sub_aggregates": [
null
]
"time_zone": "string",
"type": "string"
}]
response = falcon.command("PostAggregatesAlertsV2", body=BODY, include_hidden=boolean)
print(response)
Perform actions on alerts identified by alert ID(s) in request.
update_alerts_v2 (or update_alerts)
Method | Route |
---|---|
/alerts/entities/alerts/v2 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
action_parameters |
|
|
body | list of dictionaries | List of dictionaries containing action specific parameter settings. |
add_tag |
|
|
body action_parameters |
string | Add a tag to 1 or more alert(s). |
append_comment |
|
|
body action_parameters |
string | Appends new comment to existing comments. |
assign_to_name |
|
|
body action_parameters |
string | Assign 1 or more alert(s) to a user identified by user name. |
assign_to_user_id |
|
|
body action_parameters |
string | Assign 1 or more alert(s) to a user identified by user id (eg: [email protected]). |
assign_to_uuid |
|
|
body action_parameters |
string | A user ID (Ex: [email protected]) to assign the alert to. |
body |
|
|
body | dictionary | Full body payload in JSON format. |
ids |
|
|
body | string or list of strings | ID(s) of the alerts to update, which you can find with theGetQueriesAlertsV1 operation. |
new_behavior_processed |
|
|
body action_parameters |
string | Adds a newly processed behavior to 1 or more alert(s). |
remove_tag |
|
|
body action_parameters |
string | Remove a tag from 1 or more alert(s). |
remove_tag_by_prefix |
|
|
body action_parameters |
string | Remove tags with given prefix from 1 or more alert(s). |
show_in_ui |
|
|
body action_parameters |
boolean | Boolean determining if this alert is displayed in the Falcon console.
|
unassign |
|
|
body action_parameters |
string | Unassign an previously assigned user from 1 or more alert(s). The value passed to this action is ignored. |
update_status |
|
|
body action_parameters |
string | Update status of the alert. Allowed values:
|
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.update_alerts_v2(add_tag="string",
append_comment="string",
assign_to_name="string",
assign_to_user_id="string",
assign_to_uuid="string",
ids=id_list,
new_behavior_processed="string",
remove_tag="string",
remove_tags_by_prefix="string",
show_in_ui=boolean,
unassign="string",
update_status="string"
)
print(response)
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.PatchEntitiesAlertsV2(add_tag="string",
append_comment="string",
assign_to_name="string",
assign_to_user_id="string",
assign_to_uuid="string",
ids=id_list,
new_behavior_processed="string",
remove_tag="string",
remove_tags_by_prefix="string",
show_in_ui=boolean,
unassign="string",
update_status="string"
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = ['ID1', 'ID2', 'ID3']
BODY = {
"ids": id_list,
"request": {
"action_parameters": [
{
"name": "string",
"value": "string"
}
]
}
}
response = falcon.command("PatchEntitiesAlertsV2", body=BODY)
print(response)
Perform actions on alerts identified by alert ID(s) in request.
update_alerts_v3
Method | Route |
---|---|
/alerts/entities/alerts/v3 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
action_parameters |
|
|
body | list of dictionaries | List of dictionaries containing action specific parameter settings. |
add_tag |
|
|
body action_parameters |
string | Add a tag to 1 or more alert(s). |
append_comment |
|
|
body action_parameters |
string | Appends new comment to existing comments. |
assign_to_name |
|
|
body action_parameters |
string | Assign 1 or more alert(s) to a user identified by user name. |
assign_to_user_id |
|
|
body action_parameters |
string | Assign 1 or more alert(s) to a user identified by user id (eg: [email protected]). |
assign_to_uuid |
|
|
body action_parameters |
string | A user ID (Ex: [email protected]) to assign the alert to. |
body |
|
|
body | dictionary | Full body payload in JSON format. |
composite_ids |
|
|
body | string or list of strings | Composite ID(s) of the alerts to update, which you can find with theGetQueriesAlertsV1 operation. |
include_hidden |
|
|
query | string | Allows previously hidden alerts to be retrieved. |
new_behavior_processed |
|
|
body action_parameters |
string | Adds a newly processed behavior to 1 or more alert(s). |
remove_tag |
|
|
body action_parameters |
string | Remove a tag from 1 or more alert(s). |
remove_tag_by_prefix |
|
|
body action_parameters |
string | Remove tags with given prefix from 1 or more alert(s). |
show_in_ui |
|
|
body action_parameters |
boolean | Boolean determining if this alert is displayed in the Falcon console.
|
unassign |
|
|
body action_parameters |
string | Unassign an previously assigned user from 1 or more alert(s). The value passed to this action is ignored. |
update_status |
|
|
body action_parameters |
string | Update status of the alert. Allowed values:
|
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.update_alerts_v3(add_tag="string",
append_comment="string",
assign_to_name="string",
assign_to_user_id="string",
assign_to_uuid="string",
composite_ids=id_list,
include_hidden=boolean,
new_behavior_processed="string",
remove_tag="string",
remove_tags_by_prefix="string",
show_in_ui=boolean,
unassign="string",
update_status="string"
)
print(response)
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.PatchEntitiesAlertsV3(add_tag="string",
append_comment="string",
assign_to_name="string",
assign_to_user_id="string",
assign_to_uuid="string",
composite_ids=id_list,
include_hidden=boolean,
new_behavior_processed="string",
remove_tag="string",
remove_tags_by_prefix="string",
show_in_ui=boolean,
unassign="string",
update_status="string"
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = ['ID1', 'ID2', 'ID3']
BODY = {
"composite_ids": id_list,
"request": {
"action_parameters": [
{
"name": "string",
"value": "string"
}
]
}
}
response = falcon.command("PatchEntitiesAlertsV3", body=BODY, include_hidden=boolean)
print(response)
Retrieve all Alerts given their IDs.
get_alerts_v1 (or get_alerts)
Method | Route |
---|---|
/alerts/entities/alerts/v1 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body |
|
|
body | dictionary | Full body payload in JSON format. |
ids |
|
|
body | string or list of strings | ID(s) of the alerts to retrieve. Specify one or more alert IDs (max 1000 per request). Find alert IDs with the GetQueriesAlertsV1 operation. |
In order to use this method, either a body
keyword or the ids
keyword must be provided.
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.get_alerts_v1(ids=id_list)
print(response)
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.PostEntitiesAlertsV1(ids=id_list)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.command("PostEntitiesAlertsV1", ids=id_list)
print(response)
Retrieve all Alerts given their composite IDs.
get_alerts_v2
Method | Route |
---|---|
/alerts/entities/alerts/v2 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body |
|
|
body | dictionary | Full body payload in JSON format. |
composite_ids |
|
|
body | string or list of strings | ID(s) of the alerts to retrieve. Specify one or more alert IDs (max 1000 per request). Find alert IDs with the GetQueriesAlertsV1 operation. |
include_hidden |
|
|
query | string | Allows previously hidden alerts to be retrieved. |
parameters |
|
|
query | dictionary | Full query string parameters payload in JSON format. |
In order to use this method, either a body
keyword or the ids
keyword must be provided.
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.get_alerts_v2(composite_ids=id_list, include_hidden=boolean)
print(response)
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.PostEntitiesAlertsV2(composite_ids=id_list, include_hidden=boolean)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
body_payload = {
"composite_ids": ["ID1", "ID2", "ID3"]
}
response = falcon.command("PostEntitiesAlertsV2", body=body_payload, include_hidden=boolean)
print(response)
Search for alert IDs that match a given query.
query_alerts_v1 (or query_alerts)
Method | Route |
---|---|
/alerts/queries/alerts/v1 |
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
filter |
|
|
query | string | Filter alerts using a query in Falcon Query Language (FQL) An asterisk wildcard * includes all results. |
limit |
|
|
query | integer | The maximum number of alerts to return in this response (default: 10000; max: 10000). Use with the offset parameter to manage pagination of results. |
offset |
|
|
query | integer | The first alert to return, where 0 is the latest alert. Use with the limit parameter to manage pagination of results. |
parameters |
|
|
query | dictionary | Full query string parameters payload in JSON format. |
q |
|
|
query | string | Search all alert metadata for the provided string |
sort |
|
|
query | string | Sort alerts using the provided FQL filter. |
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.query_alerts_v1(offset=integer,
limit=integer,
sort="string",
filter="string",
q="string"
)
print(response)
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.GetQueriesAlertsV1(offset=integer,
limit=integer,
sort="string",
filter="string",
q="string"
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.command("GetQueriesAlertsV1",
offset=integer,
limit=integer,
sort="string",
filter="string",
q="string"
)
print(response)
Search for alert IDs that match a given query.
query_alerts_v2
Method | Route |
---|---|
/alerts/queries/alerts/v2 |
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
filter |
|
|
query | string | Filter alerts using a query in Falcon Query Language (FQL) An asterisk wildcard * includes all results. |
include_hidden |
|
|
query | string | Allows previously hidden alerts to be retrieved. |
limit |
|
|
query | integer | The maximum number of alerts to return in this response (default: 100; max: 10000). Use with the offset parameter to manage pagination of results. |
offset |
|
|
query | integer | The first alert to return, where 0 is the latest alert. Use with the limit parameter to manage pagination of results. |
parameters |
|
|
query | dictionary | Full query string parameters payload in JSON format. |
q |
|
|
query | string | Search all alert metadata for the provided string |
sort |
|
|
query | string | Sort alerts using the provided FQL filter. |
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.query_alerts_v2(offset=integer,
limit=integer,
include_hidden=boolean,
sort="string",
filter="string",
q="string"
)
print(response)
from falconpy import Alerts
# Do not hardcode API credentials!
falcon = Alerts(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.GetQueriesAlertsV2(offset=integer,
limit=integer,
include_hidden=boolean,
sort="string",
filter="string",
q="string"
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.command("GetQueriesAlertsV2",
offset=integer,
include_hidden=boolean,
limit=integer,
sort="string",
filter="string",
q="string"
)
print(response)