This page provides a reference for AWS CloudWatch actions available in the workflow automation actions catalog. Use these actions to retrieve and upload log data in AWS CloudWatch.
Prerequisites
Before using AWS actions in workflow automation, ensure you have:
- An AWS account with appropriate permissions.
- AWS credentials configured (IAM user credentials, IAM role ARN, or session credentials).
- The necessary IAM permissions for the specific AWS services you plan to use.
See Set up AWS credentials for information on how to create IAM users and IAM roles, and set up static and session AWS credentials for integration with workflow automation AWS actions.
Get log events
The action identifier is aws.cloudwatch.getLogEvents.
Retrieves a batch of log events from a specified log stream in AWS CloudWatch Logs.
The following table describes the input fields for this action.
Input | Type | Description | Example |
|---|---|---|---|
| String | Optional. IAM role ARN to assume for AWS API calls. |
|
| String | Optional. AWS access key ID. Pass as a secret. |
|
| String | Optional. AWS secret access key. Pass as a secret. |
|
| String | Optional. Temporary session token for STS authentication. Pass as a secret. |
|
| String | Required. AWS region of the target log group. |
|
| String | Required. Name of the log stream to retrieve events from. |
|
| String | Optional. Name of the log group containing the log stream. |
|
| String | Optional. ARN or name of the log group. Use instead of |
|
| Int | Optional. Start of the time range, expressed as a Unix timestamp in milliseconds. |
|
| Int | Optional. End of the time range, expressed as a Unix timestamp in milliseconds. |
|
| Int | Optional. Maximum number of log events to return. |
|
| Boolean | Optional. If |
|
| Boolean | Optional. If |
|
| String | Optional. Pagination token from a previous response to retrieve the next page of results. |
|
The following table describes the output fields for this action.
Output | Type | Example |
|---|---|---|
| Object |
|
| Boolean |
|
| String |
|
The following example workflow shows how to use this action.
name: get-lambda-logsdescription: 'Retrieve log events from an AWS Lambda function'workflowInputs: region: type: String defaultValue: us-east-2 logGroupName: type: String defaultValue: /aws/lambda/my-function logStreamName: type: String defaultValue: 2023/10/27/[$LATEST]abcdef123456steps: - name: get_events_step type: action action: aws.cloudwatch.getLogEvents version: '1' inputs: region: ${{ .workflowInputs.region }} logGroupName: ${{ .workflowInputs.logGroupName }} logStreamName: ${{ .workflowInputs.logStreamName }} limit: 100 next: endUpload log events
The action identifier is aws.cloudwatch.putLogEvents.
Uploads a batch of log events to the specified log stream in AWS CloudWatch Logs.
The following table describes the input fields for this action.
Input | Type | Description | Example |
|---|---|---|---|
| String | Optional. IAM role ARN to assume for AWS API calls. |
|
| String | Optional. AWS access key ID. Pass as a secret. |
|
| String | Optional. AWS secret access key. Pass as a secret. |
|
| String | Optional. Temporary session token for STS authentication. Pass as a secret. |
|
| String | Required. AWS region of the target log group. |
|
| String | Required. Name of the log group to upload events to. |
|
| String | Required. Name of the log stream to upload events to. |
|
| List | Required. List of log events to upload. Each event must include a |
|
| Dict | Optional. Entity metadata to associate with the log events for New Relic entity correlation. |
|
The following table describes the output fields for this action.
Output | Type | Example |
|---|---|---|
| Object |
|
| Boolean |
|
| String |
|
The following example workflow shows how to use this action.
name: put-custom-logsdescription: 'Upload a batch of custom log events to CloudWatch'workflowInputs: region: type: String defaultValue: us-east-2 logGroupName: type: String defaultValue: my-custom-app-logs logStreamName: type: String defaultValue: instance-01-thread-01steps: - name: upload_logs type: action action: aws.cloudwatch.putLogEvents version: '1' inputs: region: ${{ .workflowInputs.region }} logGroupName: ${{ .workflowInputs.logGroupName }} logStreamName: ${{ .workflowInputs.logStreamName }} logEvents: - timestamp: 1698384000000 message: "Workflow started successfully" - timestamp: 1698384005000 message: "Step 1 completed" next: end