This guide shows you how to query and analyse Peakhour security events using Google Cloud's Log Explorer. By mastering these techniques, you'll enhance your ability to monitor and respond to security incidents.
Peakhour logs use a structured JSON format. Key fields include:
time
: UTC timestamp of the eventclient
: Client's IP addressmethod
: HTTP method of the requestpath
: Path of the requested resourceblock.by
: Type of block that occurred (e.g., WAF, IP threat list, custom rule)For a full list of fields, refer to the Peakhour Event JSON Format documentation.
To see all Peakhour logs:
resource.type="global"
logName="projects/[PROJECT_ID]/logs/peakhour-logs"
Replace [PROJECT_ID]
with your actual project ID.
Use the time range selector at the top of the Log Explorer to set your desired time range.
To see logs for a specific block type:
resource.type="global"
logName="projects/[PROJECT_ID]/logs/peakhour-logs"
jsonPayload.block.by="WAF"
Replace WAF
with other block types like ip_threat_list
, custom_rule
, or rate_limit
as needed.
To find the top countries generating blocked requests:
resource.type="global"
logName="projects/[PROJECT_ID]/logs/peakhour-logs"
| parse jsonPayload.geoip.country_code as country
| count(*) by country
| top 10
To see requests from IP addresses on threat lists:
resource.type="global"
logName="projects/[PROJECT_ID]/logs/peakhour-logs"
jsonPayload.blocklists:*
To identify potential DDoS attacks, look for high volumes of requests from a single IP:
resource.type="global"
logName="projects/[PROJECT_ID]/logs/peakhour-logs"
| parse jsonPayload.client as ip
| count(*) by ip
| filter f1 > 1000
This query finds IPs that have made more than 1000 requests.
You can create log-based metrics to track important trends over time:
You can then use this metric in Cloud Monitoring dashboards and alerting policies.
To create alerts based on your Peakhour logs:
By leveraging these querying techniques in Google Cloud's Log Explorer, you can gain valuable insights from your Peakhour security events, enabling faster incident response and more effective threat detection.