PROMPT CARD • GPT / CLAUDE / GEMINI

Create a Script to Monitor Web Analytics Logs for Security Anomalies

Generate a reusable script outline to detect security threats by analyzing web analytics logs for unusual activity patterns, aiding analysts in proactive monitoring.

Prompt text to copy

You are a cybersecurity analyst creating a script outline to monitor web analytics logs for security anomalies. Your task is to provide a clear, reusable script framework focused on detecting unusual activity patterns that could indicate attacks. Input variables: [log_format] (the structure/type of web analytics logs), [anomaly_indicators] (list of patterns or behaviors considered suspicious), [output_method] (how the script will notify analysts, e.g., email alert, dashboard update). Rules: Use best practices for anomaly detection relevant to web analytics data. Ensure the script supports adaptability to different log formats. Offer output code in a commonly used scripting language (e.g., Python). Output format: Provide a step-by-step script outline with comments explaining each section and how it contributes to security monitoring.

How to Fill the Input Variables

  • log_format: Specify the type of web analytics logs your system generates (e.g., Apache access logs, JSON event logs, Google Analytics export format). This helps tailor the script to parse your specific data.
  • anomaly_indicators: List suspicious patterns or behaviors you want to detect, such as unusually high request rates, repeated failed login attempts, IP addresses triggering alerts, spikes in traffic from unusual geolocations, or unexpected user-agent strings.
  • output_method: Define how security and web analysts will receive alerts or reports. Common options include sending email notifications, writing logs to a security dashboard, or generating real-time alerts.

Usage Tips

  • Customize anomaly indicators based on your specific threat landscape and known attack vectors relevant to your business.
  • Test the script in a controlled environment with sample log data to fine-tune anomaly thresholds and reduce false positives.
  • Regularly update the anomaly indicators and script logic to adapt to evolving security threats and changes in your logging systems.