🕳️
The Cyber Security Library
  • The Library
  • Offensive Security
    • Solar, Exploiting log4j
      • Reconnaissance
      • Discovery
      • Proof of Concept
      • Exploitation
    • Basic Authentication Bypass
      • Username Enumeration
      • Brute Force
      • Logic Flaw
      • Cookie Tampering
    • Insekube
      • Recon with Nmap
      • Checking out the web address
      • Creating a Reverse shell
      • Inside the Kubernetes pod
      • CVE-2021-43798
    • Snort
      • What is Snort? (For the uninitiated)
      • Task exercise
      • Traffic Generator
      • Brief overview of IDS and IPS
      • Checking Snort
      • Snort Sniffer mode
      • Packet Logger mode
    • Runtime Detection Evasion
      • Learning Objectives of AMSI
      • Runtime detections
      • AMSI Overview
      • AMSI Instrumentation
      • Powershell Downgrade
      • Powershell Reflection
      • Patching AMSI
    • Red team recon using OSINT
      • Taxonomy of Reconnaissance
      • Built-in tools
      • Advanced Searching
      • Specialized Search Engines
  • Malware
    • Introduction to Malware Analysis
      • What are the different types of malware analysis
      • Doing different types of analysis
      • Anti analysis techniques
    • Ransomeware: Maze
    • Exploring Steganography
    • Simple Trojan with Python
      • The Python Trojan
      • Breaking down the python code
  • Vulnerability Management
    • Nessus
      • Introduction
      • Nessus Essentials
      • Scans
      • Authenticated Scans
      • Results
      • Running custom scans
  • Cloud
    • AWS
      • AWS CDK: Deploy and using amazon SQS Que from Repo
        • Node modules and Bootstrapping troubleshooting
        • Sending and Receiving information from the stack
        • Destroying the stack and cleaning up
      • Using Different AWS Services with Splunk
        • AWS Config
          • How Does Config work?
          • How to enable Config
          • Settings
          • Aggregation
          • Creating Config Resource
          • Creating Aggregator
          • Adding Rules
        • CloudTrail
          • What is CloudTrail?
          • Features of CloudTrail
          • Benefits of CloudTrail
          • CloudTrail Event History
          • Securing CloudTrail
        • EventBridge
          • Configuring EventBridge and Event Patterns
          • EventBridge Targets
        • CloudWatch
          • The CloudWatch Dashboard
            • Virtual Machine
          • CloudWatch Alarms and Metric Filters
            • Searching logs using metric filters
            • CloudWatch Alarms
          • CloudWatch CIS Alarms
            • SNS
        • Configuring VPC Flow Logs
          • An introduction to VPC flow logs
        • Automating Incident Response with EventBridge
          • Creating Lambda functions
        • CloudTrail SIEM Integration (Splunk)
          • AWS architecture for integrating with Splunk
      • AWS DevOps EBS Volumes
        • CloudWatch
        • EBS Volume
        • Lambda
      • EKS Creating a deployment with AWS in the command Line
        • Setting up AWS Cloud9
        • Creating a Cluster
        • Creating Deployment
      • How to CloudShell SSH in to ec2 Instances
    • Azure
      • Worker CTF (Azure DevOps)
        • Enumeration
        • Using SVN
        • Exploring the Domain
        • Cracking Azure DevOps console
      • Software development environments and Azure DevOps pipeline abuse
        • Accessing Azure Devops
        • Exploring Project Pages
  • Splunk
    • Splunk SIEM Integration
      • AWS architecture for integrating with Splunk
    • Splunk Threat Hunting Ep.6 Credential Access
  • DevOps
    • Using AWS, Docker, Jenkins and SonarQube to improve code quality
      • Updating the Cloud Instance and Getting Docker
      • Installing SonarQube
      • Creating Jenkins Server
      • Manaing SonarQube and Jenkins
    • Creating a Codebuild project and getting the output with CloudWatch Logs
      • IAM
      • CodeBuild
  • CTF's
    • THM Wonderland
      • Nmap and Gobuster
      • Entering Wonderland
      • Privilege Escalation
    • Healthcare OpenEMR system -THM Plotted EMR
      • Recon with Nmap
      • Exploring the ports found
      • Gobuster
      • Searchsploit Open emr
    • Steam Cloud CTF Exploiting Kubernetes
      • SteamCloud Privilege Escalation
    • THM Flatline CTF
      • Recon with Nmap
      • Searchsploit for freeswitch
      • Using the exploit
      • Escalating my privileges
      • Gaining access inside the Windows RDP
    • Biteme CTF
      • Recon
      • Looking into the PHP code and decoding hexadecimal
      • Python script and Bash script
      • Bruteforcing MFA Code
      • Trying to gain access via SSH
      • Inside SSH
      • Fail2ban Privilege Escalation
    • Devoops CTF
      • Enumeration
      • Exploiting Web Page
      • Creating Python exploit
    • GoBox CTF
      • Enumeration
      • Using Burpsuite and creating Reverse shell
    • Explore: Android Box
      • Enumeration
      • Initial foothold
      • Privilege escalation
Powered by GitBook
On this page
  1. Cloud
  2. AWS
  3. Using Different AWS Services with Splunk
  4. CloudWatch
  5. CloudWatch Alarms and Metric Filters

CloudWatch Alarms

PreviousSearching logs using metric filtersNextCloudWatch CIS Alarms

Last updated 1 year ago

CloudWatch alarms

Once you've set up a metric filter on a log group, you can then set up an alarm based on it. This allows you to monitor specific behaviour in your AWS account more efficiently or take automated actions based on particular parameters.

With your metric filter selected on the log group, select Create alarm.

You can then select the actions you want to be taken when the alarm enters a specific state.

An alarm can be in one of three states. The alarm enters the In alarm state when the rules set out for the threshold are met. If the metric falls within the defined threshold, it transfers to the OK state. The alarm will display as Insufficient data if there has been nothing published to the metric for it to compare.

Now I’ll be setting up a metric on a log group that captures all management events from CloudTrail. The metric will look for when policies are deleted from your account. i’ll then set up an alarm that triggers when one of these events happens. Finally, i’ll use metric filter syntax to search through the logs to find information about a user's activities.

Navigate to the CloudWatch console and select the log group called MetrolioLogGroup. Use the Action drop-down menu to create a metric filter for the log group. Use the following metric syntax to filter for events where a user has deleted a policy: {($.eventName=DeletePolicy)}. Ignore the Test pattern panel and select Next. Name the filter PolicyDeleteFilter. Use LogMetrics for the namespace, PolicyDelete for the metric name, and 1 for the metric value.

Next, With your new metric selected, click on Create alarm. For the statistic type, choose Sum and change the period to 1 minute. We want the alarm to trigger if the filter finds even one of these events, so set a Static Threshold using the Greater/Equal operator with a threshold value of 1. Remove the alarm state trigger. Set the alarm name to be Metrolio-Policy-Delete and click to create it.

Next, To trigger the alarm, navigate to the IAM console and select Policies on the left-hand side. Delete the policy called Delete-Me

You've been asked to provide information on what a developer with the username "Hades12" has been doing in AWS. Using the filter pattern syntax described in the briefing panel, search "MetrolioLogGroup" in CloudWatch logs and determine the name of the policy the user has created.

Within the logs, if you filter by “Hades12” you will be able to find the policy.

You'll then be able to specify what will trigger the alarm. The statistic option lets you determine whether you want the total of the metric in a specific period (Sum), the maximum value that was published, or the average of the values published in the period. More options are detailed in the . The threshold is what the value gets compared against to determine whether to change the state of the alarm. A static threshold is a value that doesn’t change, whereas Anomaly detection uses historical data to try and determine if the value seen in the account is out of the ordinary. You can then select whether the alarm should trigger if the value seen in the account is above or below the threshold. Finally, the number the alarm will compare the statistic against is the threshold value. We decided to have the metric filter publish 1 every time it matches a log event. If we want the alarm to trigger every time that pattern is seen, we'll set the threshold value to 1 and the comparison to Greater/Equal. If we wanted the alarm to trigger when there were more than five events in the period, we would set the value to 5 and the comparison to Lower.

You can define actions for each of these states. Alarms can send notifications via SNS, so you'll be notified when the metric filter spots the specified behavior. There are also more specific options for EC2 events, such as triggering auto-scaling and system manager actions detailed in the .

AWS documentation
AWS documentation