Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge changes from upstream #6

Merged
merged 85 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
4eef147
added nr_tags variable
FouadMerhi Feb 9, 2022
1430a24
Merge pull request #53 from FouadMerhi/patch-1
mrickard Apr 12, 2022
d4aabc4
docs: infra payload format
keegoid-nr May 17, 2022
9c3d32f
fix: invoked function arn
keegoid-nr May 17, 2022
9f23164
fix: log stream name
keegoid-nr May 17, 2022
1c6bbe7
Merge pull request #61 from keegoid-nr/kmullaney/readme-payload-format
mrickard May 18, 2022
a6bb7a2
fix: Bumping version for release
mrickard May 18, 2022
3575498
docs: notes format
keegoid-nr May 18, 2022
7f8a67e
fix: extra star
keegoid-nr May 18, 2022
b25db25
Merge pull request #63 from keegoid-nr/kmullaney/fix-notes-format
mrickard May 18, 2022
41dc927
docs: change notes to footnote
keegoid-nr May 18, 2022
0647a3b
Merge pull request #64 from keegoid-nr/kmullaney/footnotes
mrickard May 18, 2022
744c6cd
docs: update encoding and headers
keegoid-nr May 18, 2022
84e58d5
feat: update to python3.9
keegoid-nr May 24, 2022
222f880
add trace.id to log_message
yahmed153 May 26, 2022
a91d685
Merge pull request #71 from newrelic/LAMBDA-1452-SIGNED
yahmed153 May 26, 2022
1c0ce05
Merge branch 'master' into kmullaney/encoding
keegoid-nr Jun 9, 2022
76b5ef3
Merge branch 'master' into kmullaney/python39
yahmed153 Jun 9, 2022
cc828dd
Merge pull request #67 from keegoid-nr/kmullaney/python39
yahmed153 Jun 9, 2022
cadc8ca
Merge branch 'master' into kmullaney/encoding
yahmed153 Jun 9, 2022
02391d8
Merge pull request #65 from keegoid-nr/kmullaney/encoding
yahmed153 Jun 9, 2022
fb29862
Merge branch 'master' into mrickard/bump-version-to-2.6.6
yahmed153 Jun 9, 2022
2ca12f8
Merge pull request #62 from newrelic/mrickard/bump-version-to-2.6.6
yahmed153 Jun 9, 2022
1dada2e
Add Python 3.9 support\nAdd trace.id to log message
yahmed153 Jun 10, 2022
70ee6d0
Merge pull request #73 from newrelic/bump-version-to-2.7.0
yahmed153 Jun 10, 2022
c0648d4
Make `Metadata.SemanticVersion` match latest release
luckslovez Apr 18, 2023
7ceca94
Merge pull request #84 from luckslovez/fix-semantic-version
luckslovez Apr 20, 2023
8692614
Use gh actions (#86)
luckslovez Apr 24, 2023
aef24c6
Update dependencies (#85)
luckslovez Apr 25, 2023
cf2191d
Typo
luckslovez Apr 25, 2023
9b7f4af
Simplify release action
luckslovez Apr 25, 2023
084af12
Merge branch 'master' of github:newrelic/aws-log-ingestion
luckslovez Apr 25, 2023
ec69d57
Undocumented params
luckslovez Apr 25, 2023
794c760
Add permissions
luckslovez Apr 25, 2023
efb0869
Fix permissions
luckslovez Apr 25, 2023
9939c01
Add write permission
luckslovez Apr 25, 2023
beeffc6
Add slack notification
luckslovez Apr 25, 2023
ae9f7d5
Use url instead
luckslovez Apr 25, 2023
151c221
generic workflow
luckslovez Apr 27, 2023
bf303b8
typo
luckslovez Apr 27, 2023
45a5d93
Update dependencies
TimPansino Jun 27, 2023
1043b44
Merge pull request #87 from newrelic/update-dependencies
TimPansino Jun 28, 2023
de0271f
feat: Allow installing the integration more than once per account and…
jcsobrino Jul 27, 2023
7418572
feat: Bumped application version
jcsobrino Jul 27, 2023
2c1dae8
Merge pull request #88 from jcsobrino/NR-94784-Deploy_more_than_once_…
jcsobrino Jul 27, 2023
4d230d0
feat: Bumped Python runtime to v3.11
jcsobrino Nov 14, 2023
1fcb668
feat: Bumped Python runtime to v3.11
jcsobrino Nov 14, 2023
e4f07f0
feat: Bumped Python runtime to v3.11 in GitHub workflows
jcsobrino Nov 14, 2023
55d16a8
feat: Bumped Poetry to v1.7 in GitHub PR workflow
jcsobrino Nov 14, 2023
6a992a2
fix: PyYaml broken with cython 3 versions 5.4.1 and 5.4.0
jcsobrino Nov 14, 2023
36d66bc
fix: Minor change in PY file
jcsobrino Nov 14, 2023
15050df
fix: Downgraded Poetry to v1.4 in GitHub PR workflow
jcsobrino Nov 14, 2023
b223420
fix: Added poetry.lock file
jcsobrino Nov 23, 2023
2d6bb83
fix: set LOGGING_LAMBDA_VERSION as 1.1.0
jcsobrino Dec 14, 2023
fcc3b64
fix: set LOGGING_LAMBDA_VERSION as 2.9.0
jcsobrino Dec 15, 2023
378a603
Merge pull request #93 from jcsobrino/bump-python-runtime-3.11
jcsobrino Dec 15, 2023
558f0ad
fix: downgraded python version to 3.10 in release.yml because sam cli…
jcsobrino Dec 15, 2023
6e9b005
Merge branch 'master' into bump-python-runtime-3.11
jcsobrino Dec 15, 2023
575368d
Merge pull request #96 from jcsobrino/bump-python-runtime-3.11
jcsobrino Dec 15, 2023
be42f7d
fix: downgraded python version to 3.10 poetry.lock because sam cli do…
jcsobrino Dec 15, 2023
729e182
Merge remote-tracking branch 'origin/bump-python-runtime-3.11' into b…
jcsobrino Dec 15, 2023
af6864c
Merge branch 'newrelic:master' into bump-python-runtime-3.11
jcsobrino Dec 15, 2023
2a5ade2
Merge pull request #97 from jcsobrino/bump-python-runtime-3.11
jcsobrino Dec 15, 2023
ad42354
fix: downgraded python version to 3.10 pyproject.toml because sam cli…
jcsobrino Dec 15, 2023
b4eefb0
Merge branch 'newrelic:master' into bump-python-runtime-3.11
jcsobrino Dec 15, 2023
cbf5852
Merge pull request #98 from jcsobrino/bump-python-runtime-3.11
jcsobrino Dec 15, 2023
f8654c3
fix: upgraded python version to 3.11 in release.yml and pyproject.toml
jcsobrino Dec 18, 2023
f6e69bd
Merge remote-tracking branch 'origin/bump-python-runtime-3.11' into b…
jcsobrino Dec 18, 2023
81ba812
Merge branch 'master' into bump-python-runtime-3.11
jcsobrino Dec 18, 2023
f2877bd
Merge pull request #99 from jcsobrino/bump-python-runtime-3.11
jcsobrino Dec 18, 2023
a52c4a3
fix: removed poetry from command `sam publish`
jcsobrino Dec 18, 2023
9452ae6
Merge remote-tracking branch 'origin/bump-python-runtime-3.11' into b…
jcsobrino Dec 18, 2023
8188383
Merge branch 'master' into bump-python-runtime-3.11
jcsobrino Dec 18, 2023
da1a344
Merge pull request #100 from jcsobrino/bump-python-runtime-3.11
jcsobrino Dec 18, 2023
0cdd908
fix: added poetry from command `sam publish`
jcsobrino Feb 5, 2024
132c65c
Merge pull request #103 from jcsobrino/master
jcsobrino Feb 5, 2024
514a185
Update dependencies to fix CVEs
nr-dsharma Feb 7, 2024
92f8beb
fix: check release GitHub action works correctly
jcsobrino Feb 8, 2024
37a83e8
Merge pull request #105 from jcsobrino/fix-release-github-action
jcsobrino Feb 8, 2024
347ba99
Merge branch 'master' into vulnerabilities_fix
nr-dsharma Feb 8, 2024
7b175eb
Updated lambda version to next version 2.9.2
nr-dsharma Feb 8, 2024
afa94b0
Merge pull request #104 from nr-dsharma/vulnerabilities_fix
jcsobrino Feb 8, 2024
d04c162
version bump for vulnerabilities fixes
nr-dsharma Jun 18, 2024
e0f511a
Merge pull request #116 from nr-dsharma/NR-279411_vuln_fix_2
danybmx Jun 18, 2024
92bba43
Merge remote-tracking branch 'upstream/master' into chore/merge-upstream
ankon Aug 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 0 additions & 96 deletions .circleci/config.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: New Relic - AWS Logs Ingestion - Pull Request

on: [pull_request]

jobs:
lint:
strategy:
matrix:
python-version: ["3.11"]
poetry-version: ["1.4"]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install Project
run: poetry install --no-interaction
- name: Lint
run: |
poetry run flake8 src test
poetry run black --check src test
test:
strategy:
matrix:
python-version: ["3.11"]
poetry-version: ["1.4"]
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install Project
run: poetry install --no-interaction
- name: Test
run: poetry run pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ __pycache__/

packaged.yaml
.aws-sam/
samconfig.toml
/src/requirements.txt

.serverless
Expand Down
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: stable
rev: 22.3.0
hooks:
- id: black
language_version: python3.7
language_version: python3.11
7 changes: 5 additions & 2 deletions Developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@

# Publishing a new version

To publish a new version [create a release](https://github.com/newrelic/aws-log-ingestion/releases/new)
and specify a tag that matches the `SemanticVersion` that appears in the `template.yml`
The version number needs to be bumped in `pyproject.toml` and `template.yaml` (in `Metadata.SemanticVersion`).
Note that both should match.

Then, to publish a new version, [create a release](https://github.com/newrelic/aws-log-ingestion/releases/new)
and specify a tag that matches the `SemanticVersion` that appears in `template.yml` (and `pyproject.toml`)
but prefixed with a `v`. For example, if the `SemanticVersion` is `1.2.3` then your
release tag should be `v1.2.3`.

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7
FROM python:3.11
RUN apt-get update
RUN apt-get install -y zip

Expand Down
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ To forward data to New Relic you need a [New Relic License Key](https://docs.new
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).

Additional notes:
* Some users in UTF-8 environments have reported difficulty with defining strings of `NR_TAGS` delimited by the semicolon `;` character. If this applies to you, you can set an alternative delimiter character as the value of `NR_ENV_DELIMITER`, and separate your `NR_TAGS` with that.

* Some users in UTF-8 environments have reported difficulty with defining strings of `NR_TAGS` delimited by the semicolon `;` character. If this applies to you, you can set an alternative delimiter character as the value of `NR_ENV_DELIMITER`, and separate your `NR_TAGS` with that.
* Custom Lambda and VPC log groups can be set using the `NR_LAMBDA_LOG_GROUP_PREFIX` and `NR_VPC_LOG_GROUP_PREFIX` environment variables.

## Manual Deployment
Expand All @@ -24,7 +25,7 @@ to deploy the log ingestion function manually.
### SAM

1. Clone this repository: `git clone https://github.com/newrelic/aws-log-ingestion.git`
2. [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) Make sure you have >=0.33.0 installed, you can check with `sam --version`.
2. [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) Make sure you have >=1.105.0 installed, you can check with `sam --version`.
3. [Retrieve your New Relic License Key](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/license-key)
4. Build the SAM application (if on Linux `-u` can be omitted): `sam build -u --parameter-overrides 'ParameterKey=NRLicenseKey,ParameterValue=your-license-key-here'`
5. Deploy the SAM application: `sam deploy --guided`
Expand Down Expand Up @@ -59,3 +60,46 @@ module "newrelic_log_ingestion" {
```

By default, this will build and pack the lambda zip inside of the Terraform Module. You can supply your own by switching `build_lambda = false`, and specify the path to your lambda, using `lambda_archive = "{{LAMBDA_PATH}}"`, replacing `{{LAMBDA_PATH}}` with the path to your lambda.

## Infra Payload Format

The maximum payload size in bytes is:

<https://github.com/newrelic/aws-log-ingestion/blob/1430a247f1fb5feb844f0707838a6ef48d21fc41/src/function.py#L76>

If your payload exceeds this size, you will need to split it into pieces:

<https://github.com/newrelic/aws-log-ingestion/blob/1430a247f1fb5feb844f0707838a6ef48d21fc41/src/function.py#L292-L306>

The payload should be utf-8 encoded and then gzipped before sending:

<https://github.com/newrelic/aws-log-ingestion/blob/1430a247f1fb5feb844f0707838a6ef48d21fc41/src/function.py#L298>

The following GNU coreutils Bash command will reproduce the desired payload encoding and compression:

```sh
xclip -sel clip -o | iconv -cf utf-8 | gzip > payload.gz
```

Required headers include:

* <https://github.com/newrelic/aws-log-ingestion/blob/1430a247f1fb5feb844f0707838a6ef48d21fc41/src/function.py#L360-L361>
* `Accept-Encoding: gzip`
* `Content-Length: <calculated when request is sent>`
* `Host: <calculated when request is sent>`

The payload should include the following (properly escaped) elements[^1]:

```json
{
"context": {
"function_name": "newrelic-log-ingestion",
"invoked_function_arn": "arn:aws:lambda:<your_aws_region>:<your_aws_account>:function:newrelic-log-ingestion",
"log_group_name": "/aws/lambda/newrelic-log-ingestion",
"log_stream_name": "<your_nli_log_stream_name>"
},
"entry": "{\"messageType\": \"DATA_MESSAGE\", \"owner\": \"<your_aws_account>\", \"logGroup\": \"/aws/lambda/<your_function_name>\", \"logStream\": \"<your_function_log_stream_name>\", \"subscriptionFilters\": [\"<your_function_name>\"], \"logEvents\": [{\"id\": \"36858672311120633630098786383886689203484013407063113737\", \"timestamp\": 1652800029012, \"message\": \"[1,\\\"NR_LAMBDA_MONITORING\\\",\\\"H4sIAAAAAAAAA+1Y3W/bNhB/919hCHu0JUrUF40hQLZ2WIBiLWBveygKgZZOHjea0kjJiRvkfx8lS66s2Elqx0XXVC/U3ZG8u98djx+3g+HQWEJBE1pQYzK81bTmUCk0UTUTeq0mnC7nCZ38uM5KGWlGJGHBMnHR4dA4zkpRXEzSUsSFFjaylowEXcKFMdrMv+WuQCrdVsp+eHM5ez2dtV3gBuKy7gNixWQmliCK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367794847255214593015820\", \"timestamp\": 1652800029017, \"message\": \"REPORT RequestId: 60d9a6a3-f31e-43e6-94a7-8485e06f8aa6\\tDuration: 13.98 ms\\tBilled Duration: 14 ms\\tMemory Size: 1024 MB\\tMax Memory Used: 87 MB\\tInit Duration: 584.39 ms\\t\\n\"}]}"
}
```

[^1]: Replace <your_xyz> elements with your content, for example: `"log_stream_name": "2022/05/17/[$LATEST]30dce751bc1a4e7497eb644171d70153"`.
Loading
Loading