Skip to content

Commit

Permalink
updated example, added additional notes section, and updated some con…
Browse files Browse the repository at this point in the history
…fig descriptions
  • Loading branch information
ZahidMirza95 committed Jul 7, 2023
1 parent fbd85e0 commit c28dea8
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions exporter/awscloudwatchlogsexporter/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# AWS CloudWatch Logs Exporter

<!-- status autogenerated section -->
| Status | |
| ------------- |-----------|
| Stability | [beta]: logs |
| Status | |
|---------------|-----------------------|
| Stability | [beta]: logs |
| Distributions | [contrib], [observiq] |

[beta]: https://github.com/open-telemetry/opentelemetry-collector#beta
Expand All @@ -13,25 +13,28 @@

AWS CloudWatch Logs Exporter sends logs data to AWS [CloudWatch Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html).
AWS credentials are retrieved from the [default credential chain](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials).
Region must be configured in the configuration if not set in the default credential chain.

NOTE: OpenTelemetry Logging support is experimental, hence this exporter is subject to change.

## Configuration

The following settings are required:

- `log_group_name`: The group name of the CloudWatch logs.
- `log_stream_name`: The stream name of the CloudWatch logs.
- `log_group_name`: The group name of the CloudWatch Logs. If it does not exist it will be created automatically.
- `log_stream_name`: The stream name of the CloudWatch Logs. If it does not exist it will be created automatically.

The following settings can be optionally configured:

- `region`: The AWS region where the log stream is in.
- `region`: The AWS region where the log stream is in. Region must be specified if it is not already set in the default credential chain.
- `endpoint`: The CloudWatch Logs service endpoint which the requests are forwarded to. [See the CloudWatch Logs endpoints](https://docs.aws.amazon.com/general/latest/gr/cwl_region.html) for a list.
- `log_retention`: LogRetention is the option to set the log retention policy for only newly created CloudWatch Log Groups. Defaults to Never Expire if not specified or set to 0. Possible values for retention in days are 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 2192, 2557, 2922, 3288, or 3653.
- `tags`: Tags is the option to set tags for the CloudWatch Log Group. If specified, please add at most 50 tags. Input is a string to string map like so: { 'key': 'value' }. Keys must be between 1-128 characters and follow the regex pattern: `^([\p{L}\p{Z}\p{N}_.:/=+\-@]+)$`(alphanumerics, whitespace, and _.:/=+-!). Values must be between 1-256 characters and follow the regex pattern: `^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$`(alphanumerics, whitespace, and _.:/=+-!). [Link to tagging restrictions](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogGroup.html#:~:text=Required%3A%20Yes-,tags,-The%20key%2Dvalue)
- `role_arn`: The AWS IAM role to upload segments to a same/different account
- `raw_log`: Boolean default false. If you want to export only the log message to cw logs. This is required for emf logs.
<<<<<<< HEAD
- `tags`: This option is used to add tags to the log group. A tag is a custom attribute label that you assign to an AWS resource. They can be used to identify and organize your resources. You can specify multiple tags in the format of a string map : {'key': 'value' }. Keys must be between 1-128 characters and follow the regex pattern: ^([\p{L}\p{Z}\p{N}.:/=+-@]+)$(alphanumerics, whitespace, and _.:/=+-!). Values must be between 1-256 characters and follow the regex pattern: ^([\p{L}\p{Z}\p{N}.:/=+-@]*)$(alphanumerics, whitespace, and _.:/=+-!). [Link to tagging restrictions](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogGroup.html#:~:text=Required%3A%20Yes-,tags,-The%20key%2Dvalue) You can specify at most 50 tags.
- `role_arn`: The AWS IAM role to upload segments to a same/different account.
=======
- `tags`: Tags is the option to set tags for the CloudWatch Log Group. If specified, please add at most 50 tags. Input is a string to string map like so: { 'key': 'value' }. Keys must be between 1-128 characters and follow the regex pattern: `^([\p{L}\p{Z}\p{N}_.:/=+\-@]+)$`(alphanumerics, whitespace, and _.:/=+-!). Values must be between 1-256 characters and follow the regex pattern: `^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$`(alphanumerics, whitespace, and _.:/=+-!). [Link to tagging restrictions](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogGroup.html#:~:text=Required%3A%20Yes-,tags,-The%20key%2Dvalue)
>>>>>>> 0d79bd2bcab89404df7ca51e67d742978c1c5b1f
- `raw_log`: Boolean default false. If set to true, only the log message will be exported to CloudWatch Logs. This needs to be set to true for [EMF logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Specification.html).

### Examples

Expand All @@ -44,21 +47,26 @@ exporters:
log_stream_name: "testing-integrations-stream"
```
All configuration options:
Example configuration for EMF logs:
```yaml
exporters:
awscloudwatchlogs:
log_group_name: "testing-logs"
log_stream_name: "testing-integrations-stream"
log_group_name: "testing-logs-emf"
log_stream_name: "testing-integrations-stream-emf"
raw_log: true
region: "us-east-1"
role_arn: "arn:aws:iam::123456789:role/monitoring-application-logs"
endpoint: "logs.us-east-1.amazonaws.com"
log_retention: 365
tags: { 'sampleKey': 'sampleValue'}
sending_queue:
queue_size: 50
retry_on_failure:
enabled: true
initial_interval: 10ms
```
## Additional Notes
- If the log group and/or log stream are specified in an EMF log, that EMF log will be exported to that log group and/or log stream (i.e. ignores the log group and log stream defined in the configuration)
- The log group and log stream will also be created automatically if they do not already exist.
- Example of an EMF log with log group and log stream:
```json
{"_aws":{"Timestamp":1574109732004,"LogGroupName":"Foo", "LogStreamName": "Bar", "CloudWatchMetrics":[{"Namespace":"MyApp","Dimensions":[["Operation"]],"Metrics":[{"Name":"ProcessingLatency","Unit":"Milliseconds","StorageResolution":60}]}]},"Operation":"Aggregator","ProcessingLatency":100}
```
- Resource ARNs (Amazon Resource Name (ARN) of the AWS resource running the collector) are currently not supported with the CloudWatch Logs Exporter.

0 comments on commit c28dea8

Please sign in to comment.