|
1 |
| -# aws-cloudwatch-firehose |
2 |
| -Forwards logs from cloudwatch to NewRelic through firehose |
| 1 | +# aws-unified-firehose |
| 2 | +Forwards logs from cloudwatch to NewRelic through Amazon Data Firehose |
| 3 | + |
| 4 | +## Features |
| 5 | + |
| 6 | +- Collects logs from Amazon CloudWatch. |
| 7 | +- Forwards logs to NewRelic using Amazon Data Firehose. |
| 8 | +- Allows users to attach custom attributes to the logs to make it easier to search, filter, analyze, and parse the logs |
| 9 | +- Scalable and reliable log forwarding. |
| 10 | +- Stores license key in Secret Manager by default. |
| 11 | + |
| 12 | +## Requirements |
| 13 | + |
| 14 | +- SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) |
| 15 | + |
| 16 | +## Deployment |
| 17 | + |
| 18 | +To try this integration out you can use the `sam` cli to deploy the cloudformation template (`firehose-template.yml`). Make sure **aws is properly authenticated with an account of your choice**. |
| 19 | + |
| 20 | + |
| 21 | +#### CloudFormation Parameters |
| 22 | + |
| 23 | +- `NewRelicRegion` : Can either be `US` or `EU` depending on which endpoint to be used to push logs to New Relic |
| 24 | + - For this param `US` is default |
| 25 | +- `LicenseKey`: Used when forwarding logs to New Relic |
| 26 | +- `LogGroupConfig` : String representation of JSON array of objects of your CloudWatch LogGroup(s) and respective filter (if applicable) to set the Lambda function trigger. |
| 27 | + - Example : ```[{"LogGroupName":"group1"}, {"LogGroupName":"group2", "FilterPattern":"ERROR"}, {"LogGroupName":"group3", "FilterPattern":"INFO"}]``` |
| 28 | +- `LoggingFirehoseStreamName` : Name of new Data Firehose Delivery Stream (must be unique per AWS account in the same AWS Region) |
| 29 | + - The default value will be `NewRelic-Logging-Delivery-Stream` |
| 30 | +- `LoggingS3BackupBucketName`: S3 Bucket Destination for failed events (must be globally unique across all AWS accounts in all AWS Regions within a partition) |
| 31 | + - The default value will be `firehose-logging-backup` |
| 32 | +- `EnableCloudWatchLoggingForFirehose`: Can either be `true` or `false` to enable CloudWatch logging for the Amazon Data Firehose stream. Enabling logging can help in troubleshooting issues in pushing data through firehose stream. `false` by default |
| 33 | +- `NewRelicAccountId` : The New Relic Account ID to which the logs will be pushed |
| 34 | +- `CommonAttributes` : Common attributes to be added to all logs. This should be a JSON object. |
| 35 | + - Example : ```[{"AttributeName": "name1", "AttributeValue": "value1"}, {"AttributeName": "name2", "AttributeValue": "value2}]``` |
| 36 | +- `StoreNRLicenseKeyInSecretManager` : Can either be `true` or `false` depending on which cloud formation stack decides whether to store your license key in the environment variables or to create a new secret in aws secrets manger. |
| 37 | + - For this param `true` is default |
| 38 | + |
| 39 | +## Building and packaging |
| 40 | +To build and package, follow these steps: |
| 41 | +1. Authenticate with your aws account details |
| 42 | +2. Create an S3 bucket with a unique name, e.g., `test123`. |
| 43 | +3. Build the project: |
| 44 | + ```sh |
| 45 | + sam build --template-file firehose-template.yaml |
| 46 | + ``` |
| 47 | +4. The build will be located by default at `.aws-sam/build`, and a template file will be created with the name `template.yaml`. |
| 48 | +5. Package the project: |
| 49 | + ```sh |
| 50 | + sam package --s3-bucket test123 --template-file .aws-sam/build/template.yaml --output-template-file firehose-template.yaml --region us-east-2 |
| 51 | + ``` |
| 52 | +6. Copy the main template file to the S3 bucket: |
| 53 | + ```sh |
| 54 | + aws s3 cp .aws-sam/build/firehose-template.yaml s3://test123/firehose-template.yaml |
| 55 | + ``` |
0 commit comments