Use these actions to retrieve and upload log data in AWS CloudWatch.
Prerequisites
For prerequisites and credentials setup, see Set up AWS credentials.
Get log events
Action identifier: aws.cloudwatch.getLogEvents
Retrieves a batch of log events from a specified log stream in AWS CloudWatch Logs.
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. |
|
Output | Type | Example |
|---|---|---|
| Object |
|
| Boolean |
|
| String |
|
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
Action identifier: aws.cloudwatch.putLogEvents
Uploads a batch of log events to the specified log stream in AWS CloudWatch Logs.
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. |
|
Output | Type | Example |
|---|---|---|
| Object |
|
| Boolean |
|
| String |
|
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