Creating collection policies to collect logs from AWS
Gather all application and services logs that are collected by the Amazon Cloudwatch service for search and analysis. CloudWatch monitors the Amazon Web Services (AWS) resources and the applications that run on AWS in real time.
The following image shows how logs are collected from your AWS accounts:
Before you begin
Here are the steps that you must perform before configuring logs collection from AWS:
- Download and install a connector. For more information, see Installing-and-managing-connectors. You can use any of the following connectors:
- Linux
- Windows
- Get the access and secret keys for your AWS account and ensure that you have access to the Cloudwatch service.
- Plan and decide which logs you want to collect. You can collect logs at the region, group, or stream levels. Ensure that you have access to the appropriate regions, groups, and streams.
To collect logs from AWS
- Click the Collection menu and select Collection Policies.
- On the Collection Policies page, click Create.
- Enter the policy information:
- Enter a unique name and description for the policy.
- From the Collection Type list, select AWS.
- Enter the access and secret keys.
- Enter the following information about connector:
- From the Connector Type list, select Linux Connector or Windows Connector.
- In Connector Selection Criteria, create the connector selection criteria to identify connectors for collection.
When you click in the box, you are prompted to make a selection. Each time you make a selection, you are progressively prompted to make another selection.
The selection criteria consist of an opening parenthesis, followed by the slot name, the operator, the slot value (which can be a string based on the type of slot selected), and the closing parenthesis. You can optionally select the logical operator AND or OR to add additional conditions. Specifying the opening and closing parentheses is optional.
The connector fields available to create the selection criteria are status, name, version, host_name, ip, and tags.
- Enter the following information about log collection:
- In the Configuration step, click Configure.
- In the Customize Logs Data panel, enter how frequently (a value in the range of 60 to 3600 seconds) )you want to refresh the collection interval.
- To filter the logs for collection, ensure that the Region/Group Filter check box is selected.
Select a region and enter a group within the region, and a stream within the group from where you want to collect logs.
To collect these logs
Instructions
Log streams whose names begin with East_Apps in the Apache_logs group.
Enter Apache_logs and East_Apps in the Log Group Pefix and Log Stream Pefix fields.
All logs of a region
Leave asterisks in the Log Group Prefix and Log Stream Prefix fields.
All logs of a stream in a group
Enter the group name in the Log Group Prefix field and asterisks in the Log Stream Prefix field.
All logs of a group or stream whose names begin with a common prefix
Enter the prefixes in these fields.
For example, to collect logs from all groups whose names begin with BMC, enter BMC in the Log Groups Prefix field.
If the region for which you want to collect logs is not present in the list, contact BMC Support.
- To add multiple regions, groups, or streams, click the + sign.
- Save the configurations.
- In the Tags field, add the tags to identify the collected logs, such as AWS_Apache_logs.
- In the Parsing Rule step, select the parsing rule that you have created.
If you have not created a parsing rule, click Create New. For more information, see Creating-a-parsing-rule. - From the Filtering Rule list, select the filtering rule that you have created.
If you have not created a filtering rule, click Create New. For more information, see Creating-a-filtering-rule. - To start collecting logs, select the Enable Collection Policy check box.
- Click Save.
The created policy is shown on the Collection Policies page. To edit, enable, disable, or delete a policy, use the Actions menu.
To verify log collection
To verify whether log collection has started, select Log Explorer > Discover. Use the tags or time range to view the collected logs.
To verify whether the parameters are correctly populated in the fluentd pipeline, go to /opt/td-agent/etc/data/<integration_ID>/pipeline. Open the file_log_pipeline.conf file by running the cat aws_logs_class_pipeline.conf command.
Learn more
Read the following blog to learn how you can enhance observability by using the AWS logs that you collect AWS cloud observability with Log Analytics.
Where to go from here