Leveraging SQL queries within the Global Investigation page allows users to extract precise insights regarding detections. Below, we've compiled a set of SQL queries tailored to fulfill various investigative needs:
1. Query for Total Assets by Specific Detection:
******
SELECT
display_name AS Rule_Name,
count(*) AS Total
FROM
upt_detections
WHERE
created_at BETWEEN TIMESTAMP '2024-01-24 00:00:00' AND TIMESTAMP '2024-01-31 23:59:59'
AND asset_host_name LIKE '%andromeda%'
AND display_name LIKE 'Bad%'
GROUP BY
1
ORDER BY
total DESC;
******
This query provides the total count of assets associated with a specific detection within a defined time frame. Users can customize the timestamp and hostname criteria for precise filtering.
2. Query for Assets Matching Specific Detection Name:
******
SELECT
asset_host_name AS Hostname,
count(*) AS Total
FROM
upt_detections
WHERE
created_at BETWEEN TIMESTAMP '2024-01-24 00:00:00' AND TIMESTAMP '2024-01-31 23:59:59'
AND display_name LIKE '%monitored utility%'
GROUP BY
1
ORDER BY
total DESC;
******
This query retrieves assets matching a specific detection name within the specified time range. Users can adjust the timestamp and detection name pattern as needed.
3. Query for Hostnames Associated with a Specific Rule:
******
SELECT
upt_hostname,
alert_rule_name,
display_name,
json_extract_scalar(metadata, '$["User"]') AS UserName,
json_extract_scalar(metadata, '$["Process"]') AS ParentProcess,
/* Additional fields extracted from metadata */
metadata,
note,
severity,
alert_time,
status,
created_at,
updated_by
FROM
upt_alerts
WHERE
alert_rule_name LIKE '%%'
AND created_at BETWEEN TIMESTAMP '2024-01-24 00:00:00' AND TIMESTAMP '2024-01-31 23:59:59'
ORDER BY
created_at DESC;
******
This query retrieves detailed information associated with a specific rule, including hostnames, alert details, and metadata. Users can customize the alert rule name for pattern matching.
Feel free to utilize these queries within the Uptycs Global Investigation page to streamline your detection analysis and investigation processes effectively. Should you have any further inquiries or require assistance, please do not hesitate to reach out.