|
1 |
| -# AWS - New Relic log ingestion |
| 1 | +[](https://github.com/newrelic/open-source-office/blob/master/examples/categories/index.md#community-project) |
2 | 2 |
|
3 |
| -AWS Serverless Application that sends log data from CloudWatch Logs to New Relic Infrastructure (Cloud integrations) and New Relic Logging. |
| 3 | +# New Relic CloudWatch Logs ingestion |
4 | 4 |
|
5 |
| -## Pre-requisites |
| 5 | +AWS Serverless application that sends log data from CloudWatch Logs to New Relic. |
6 | 6 |
|
7 |
| -To forward data to New Relic: [New Relic License Key](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/license-key) |
| 7 | +## Requirements |
8 | 8 |
|
9 |
| -## Configuration |
| 9 | +To forward data to New Relic you need a [New Relic License Key](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/license-key). |
10 | 10 |
|
11 |
| -You can configure forwarding of logs to New Relic Infrastructure and/or New Relic Logging using the following two environment variables. |
| 11 | +## Install and configure |
12 | 12 |
|
13 |
| -| Env. Variable | Behavior | Value | |
14 |
| -|---------------|----------|----------------------------| |
15 |
| -| LICENSE_KEY | Needed for sending data to both Infrastructure and Logging. If set, enables forwarding logs to New Relic Infrastructure by default | Your New Relic license key, which you can get by following [these instructions](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/license-key).| |
16 |
| -| LOGGING_ENABLED | determines if logs are forwarded to New Relic Logging | "false" by default |
17 |
| -| INFRA_ENABLED | determines if logs are forwarded to New Relic Infrastructure | "true" by default |
18 |
| -| DEBUG_LOGGING_ENABLED | determines if additional, debug logs are output during ingestion runs | "false" by default |
19 |
| - |
20 |
| - |
21 |
| -### Optional configuration |
22 |
| - |
23 |
| -| Env. Variable | Decription | Default Value | |
24 |
| -|---------------|------------|---------------------------| |
25 |
| -| NR_LOGGING_ENDPOINT | New Relic ingestion endpoint for Logging | `https://log-api.newrelic.com/log/v1` | |
26 |
| -| NR_INFRA_ENDPOINT | New Relic ingestion endpoint for Infra | `https://cloud-collector.newrelic.com` | |
27 |
| - |
28 |
| - |
29 |
| -## Configure a Lambda trigger for logging |
30 |
| -- To get your logs streaming to New Relic you will need to attach a trigger to the lambda. |
31 |
| -- To add a trigger, go under Configuration on the lambda management and select CloudWatch. |
32 |
| -- Select your desired log group and set the filter name. |
33 |
| -- Add the trigger and save the lambda. |
34 |
| - |
35 |
| -## Configure Retries |
36 |
| - |
37 |
| -You can configure the number of retries you want to perform in case the function fails to send the data in case of communication issues. |
38 |
| - |
39 |
| -Please be aware that more number of retries can make the function run for longer time and therefore increases the probability of having higher costs for Lambda. On the contrary, decreasing the number of retries could increase the probability of data loss. |
40 |
| - |
41 |
| -Recommended number is 3 retries, but you can change the retry behavior by changing the below parameters: |
42 |
| - |
43 |
| -```python |
44 |
| -MAX_RETRIES = 3 # Defines the number of retries after lambda failure to deliver data |
45 |
| -INITIAL_BACKOFF = 1 # Defines the initial wait seconds until next retry is executed |
46 |
| -BACKOFF_MULTIPLIER = 2 # Time multiplier between the retries |
47 |
| -``` |
48 |
| - |
49 |
| -As an example, in default above configuration, first retry will happen after 1 second, second retry after 2 seconds and third retry will happen after 4 seconds. |
50 |
| - |
51 |
| -## Resources created by the SAM template |
52 |
| - |
53 |
| -There are few resources that will be created when you create the application from the repository: |
54 |
| - |
55 |
| -- The Lambda function itself |
56 |
| -- A Role used to give execution permissions to the Lambda function based in CloudWatch Logs. |
57 |
| - |
58 |
| -**_All other lambda configurations not listed in the steps above can be left as the defaults._** |
| 13 | +To install and configure the New Relic Cloudwatch Logs Lambda, [see our documentation](https://docs.newrelic.com/docs/logs/enable-logs/enable-logs/aws-cloudwatch-plugin-logs). |
59 | 14 |
|
60 | 15 | ## Manual Deployment
|
61 | 16 |
|
|
0 commit comments