Amazon CloudWatch is a monitoring service that helps you track and monitor the health of your AWS applications and resources. DNIF supports the configuration of a CloudWatch Connector to pull log data directly from your CloudWatch, allowing you to write detections and perform investigations on the processed data.
Pre-requisites
- Log Group(s) names
- AWS Region
- AWS Access Key
- AWS Secret Key
Steps to derive prerequisites:-
To get your AWS Access Key and Secret Access Key, you need to create a set of credentials from the AWS Management Console. Follow these steps:
- Sign in to the AWS Management Console
- Go to the AWS Management Console at: https://aws.amazon.com/console/
- Sign in with your root account or IAM user credentials.
- Navigate to the IAM (Identity and Access Management) Dashboard
- Once logged in, from the top search bar, search for IAM and click on IAM to open the IAM dashboard.
- Create or Select an IAM User
- If you already have an IAM user that needs an access key:
- Go to Users from the left-hand menu.
- Select the IAM user to which you want to assign access keys.
- If you need to create a new IAM user:
- Click on Users in the left-hand menu.
- Click Add User at the top.
- Enter a username for the new user.
- Under Access type, check Programmatic access to generate an access key and secret key.
- Click Next: Permissions to proceed.
- If you already have an IAM user that needs an access key:
- Attach Permissions to the User
- If you're creating a new IAM user or editing an existing user:
- You need to assign permissions to the user.
- Create a least-privileged IAM policy that grants only the necessary permissions for the DNIF Connector (which pulls logs from CloudWatch Logs), you would only need permissions for:
- Reading logs from CloudWatch Logs.
- Optionally, listing log groups (if you want the user to be able to see available log groups).
- Describing log streams to navigate the logs within the log groups.
-
Here is an example of a minimal IAM policy that covers these actions:
Minimal IAM Policy for Accessing CloudWatch Logs
Explanation of the Policy:
- logs:DescribeLogGroups: Allows the user to list available CloudWatch log groups. This is optional and can be removed if you already know the log group names and don’t need the ability to list them.
- logs:DescribeLogStreams: Allows the user to list the log streams within the specified log group.
- logs:FilterLogEvents: Allows the user to query and filter the logs.
- Resource: The policy is scoped to specific log groups and log streams.
- Replace "your-log-group-name" with the name of the log group(s) you want to allow access to. You can add multiple log groups as needed.
- If you want to allow access to all log groups, you can use a wildcard ("arn:aws:logs:*:*:log-group:*").
- Click Next: Review and complete the user creation.
- If you're creating a new IAM user or editing an existing user:
- Generate the Access Key and Secret Access Key
Once the user is created or if you are editing an existing user:
- Go to the user's Security credentials tab.
- Scroll down to the Access keys section.
- Click on Create access key.
- Download or Save the Access Key
- After you generate the access key, AWS will display both the AWS Access Key ID and the AWS Secret Access Key.
- Important: This is the only time the secret key will be shown. Make sure to download the .csv file with both the access key and secret key, or copy and save it securely.
Configurations
The following are the configurations to forward AWS CloudWatch Connector logs to DNIF.
Field Name |
Description |
Connector Name |
Enter a name for the connector |
Log Group(s) |
Enter ClowdWatch Log Group(s) |
AWS Region |
Enter the CloudWatch AWS Region |
AWS Access Key |
Enter the AWS Access Key |
AWS Secret Key |
Enter the AWS Secret Key |
Scan Interval |
Enter the Scan Interval in mins |
- Click Save after entering all the required details and click Test Connection, to test the configuration.
- A Connection successful message will be displayed on screen along with the time stamp.
- If the connection is not successful an error message will be displayed. Refer Troubleshooting Connector Validations for more details on the error message.
Once the connector is configured, validate if the connector is listed under Collection Status screen with status as Active. This signifies the connector is configured successfully and data is ready to ingest.