https://github.com/theiconic/serverless-le-aws-cloudwatch
Deploy le-aws-cloudwatch using the Serverless Framework
https://github.com/theiconic/serverless-le-aws-cloudwatch
cloudwatch-logs lambda logentries serverless-framework
Last synced: about 2 months ago
JSON representation
Deploy le-aws-cloudwatch using the Serverless Framework
- Host: GitHub
- URL: https://github.com/theiconic/serverless-le-aws-cloudwatch
- Owner: theiconic
- License: mit
- Created: 2018-09-24T01:49:47.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-24T06:25:27.000Z (over 6 years ago)
- Last Synced: 2025-01-13T01:43:35.940Z (9 months ago)
- Topics: cloudwatch-logs, lambda, logentries, serverless-framework
- Language: Python
- Size: 592 KB
- Stars: 0
- Watchers: 61
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serverless le-aws-cloudwatch
[](http://www.serverless.com)
**Deploy the LogentriesCommunity [le-aws-cloudwatch](https://github.com/LogentriesCommunity/le-aws-cloudwatch) project
using the [Serverless Framework](https://serverless.com). Stream AWS Lambda and other CloudWatch logs to Logentries.**Created by the LogentriesCommunity, le-aws-cloudwatch is an AWS Lambda function written in Python that is invoked by
CloudWatch stream events and pushes the corresponding CloudWatch logs to Logentries.### Prerequisites
- Serverless Framework installed or available via CICD
- The token for a [token based log](https://docs.logentries.com/docs/input-token/) set up in Logentries
- The name of the log in CloudWatch to process (i.e. `/aws/lambda/my-function`)### Deployment
Deploy le-aws-cloudwatch from the command line using arguments:
```
serverless deploy --le-region eu --le-token abcd1234 --cw-log /aws/lambda/my-function
```Depending on your workflow you can also deploy using environment variables:
```
export LOGENTRIES_REGION=eu
export LOGENTRIES_TOKEN=abcd1234
export CLOUDWATCH_LOG=/aws/lambda/my-function
export CICD_REGION=ap-southeast-2serverless deploy
```#### Options
| Argument | Environment Variable | Description |
| --- | --- | --- |
| `le-region` | `LOGENTRIES_REGION` | The Logentries account region, currently only **eu** |
| `le-token` | `LOGENTRIES_TOKEN` | The log token generated by Logentries that will be streamed to |
| `cw-log` | `CLOUDWATCH_LOG` | The Cloudwatch log to stream to Logentries |### Working with Multiple CloudWatch Logs
As it is highly likely that you will want to process multiple CloudWatch logs we recommend using the name of
the CloudWatch log file as the stage argument from the command line:```
serverless deploy --le-region eu --le-token abcd1234 --cw-log /aws/lambda/my-function --stage my-function
```The stage name must be unique for each function and environment.
Note: If the combined service name (le-cw), stage parameter (my-function) and region (ap-southeast-2) exceed 64
characters you may receive an error similar to:```
An error occurred: IamRoleLambdaExecution - 1 validation error detected: Value 'le-cw-my-very-very-really-really-long-function-name-ap-southeast-2-lambdaRole' at 'roleName' failed to satisfy constraint: Member must have length less than or equal to 64.
```If this occurs the ony option is to shorten your stage name. This is the reason we have kept the service name short
(le-cw).### Merging the le-aws-cloudwatch Dependency
If the le-aws-cloudwatch dependency changes then those changes can be merged in using a Git
[Subtree Merge](https://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging).##### Step 1 - Add le-aws-cloudwatch as a remote
```
git remote add -f le-aws-cloudwatch https://github.com/LogentriesCommunity/le-aws-cloudwatch.git
```##### Step 2 - Pull in the changes from le-aws-cloudwatch
```
git subtree pull --prefix=le-aws-cloudwatch/ le-aws-cloudwatch master --squash
```Then push the changes or if you have created a fork open a pull request.