{"id":20471748,"url":"https://github.com/signiant/paperwatch","last_synced_at":"2025-08-02T02:34:21.203Z","repository":{"id":52244002,"uuid":"64940496","full_name":"Signiant/PaperWatch","owner":"Signiant","description":"Automatically forward CloudWatch logs posted by Amazon services to PaperTrail","archived":false,"fork":false,"pushed_at":"2024-03-05T12:24:31.000Z","size":30,"stargazers_count":19,"open_issues_count":4,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-20T11:43:59.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Signiant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-08-04T14:16:27.000Z","updated_at":"2022-09-09T16:49:19.000Z","dependencies_parsed_at":"2025-04-14T13:04:48.297Z","dependency_job_id":null,"html_url":"https://github.com/Signiant/PaperWatch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Signiant/PaperWatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2FPaperWatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2FPaperWatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2FPaperWatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2FPaperWatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Signiant","download_url":"https://codeload.github.com/Signiant/PaperWatch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2FPaperWatch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268327606,"owners_count":24232701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T14:17:09.624Z","updated_at":"2025-08-02T02:34:21.178Z","avatar_url":"https://github.com/Signiant.png","language":"JavaScript","readme":"# PaperWatch\nA tool for automatically forwarding CloudWatch logs from your lambda functions to Papertrail.\n\n## Setup\n\nFollow these steps to set up and deploy PaperWatch to AWS:\n\n#### 1. Configure\nThe two lambda functions reads the following configuration information from `config/papertrail.json`\n\n| Key | Required | Type | Description |  \n| ----- | ----- | ---------- | ----------|\n| `host` | Yes  | _String_ | The paper trail endpoint's address |  \n| `port` | Yes | _Number_ | The paper trail endpoint's port |  \n| `consumer` | Yes | _String_ | The name of the consumer function.  Used by the Subscribe function to avoid subscribing the consumer to itself.  Do not change unless you are modifying the CFN template.|  \n| `retentionPeriod` | No | _Number_ | If included, updates the CloudWatch log group's retention period (in days) |  \n| `sources` | Yes | _Array_ of _Objects_ | List of log sources.  A log source is identified by the _prefix_ property.  Log's generated by a source are passed to it's _consumer_ function.  Default configuration includes log sources for lambda functions and api gateway |  \n| `exclude` | No | _Array_ of _Strings_ | List of lambda function names that the Subscribe function should ignore |  \n| `logLevelExtractor` | Yes | _RegExp_ | Regular expression that matches the incoming CloudWatch logs and extracts the log level from them. The extracted log level will be used in the PaperTrail log. Wrap the log level part in a regex group and you are good to go\n| `defaultLogLevel` | Yes | _String_ | If logLevelExtractor is unable to match, use the level provided here.\n*Example config:*\n```\n{\n  \"host\": \"samplehost.papertrailapp.com\",\n  \"port\": 12345,\n  \"retentionPeriod\": 3\n  \"sources\": [\n    {\n      \"prefix\": \"/aws/lambda/\",\n      \"consumer\": \"LambdaLogConsumer\"\n    },\n    {\n      \"prefix\": \"API-Gateway-Execution-Logs_\",\n      \"consumer\": \"APIGatewayLogConsumer\"\n    }\n  ]\n  \"exclude\": [\n    \"TestFunction\",\n    \"LoudFunction\"\n  ],\n  \"logLevelExtractor\": \".* - (error|warn|info|verbose|debug|emerg|alert|crit|notice): \",\n  \"defaultLogLevel\": \"info\"\n}\n```\n\n#### 2. Build\nRunning the _build_ script will install dependencies and create the .zip deployment package (as lambda.zip)\n```\npaperwatch $ npm run build\n```\n\n#### 3. Deploy\nFirst, upload the deployment package to an s3 bucket.  Take note of the bucket name, you will need this later.\nThis can be done with the aws-cli as follows:\n```\npaperwatch $ aws s3 cp ./lambda.zip s3://\u003cBUCKET_NAME\u003e\n```\n\nNext, create a new cloudformation stack using from the template at ```cfn/deploy.cfn.json```.  \nEnter a stack name.  You will also be prompted to enter the following parameters:\n- SourceBucket - the name of the s3 bucket you uploaded the deployment package to\n- SourceKey - name of the deployment package in the s3 bucket (lambda.zip), including any prefixes if applicable\n\nOnce deployed, logs will be forwarded to papertrail for all new lambda functions.  \nExisting functions must be subscribed manually.  \n\n\n### Manual Subscription\nTo manually subscribe a function, navigate to the CloudWatch console and follow these steps:  \n1. Locate the log group for the function you wish to subscribe, selecting it by checking the box on the left  \n2. Open the _Actions_ dropdown and choose _Subscription filters_ -\u003e _Create lambda subscription filter_  \n3. From the Lambda Function dropdown, select the consumer function (LambdaLogConsumer or APIGatewayLogConsumer by default)\n4. From the Log Format dropdown, select _Other_ and click next  \n5. For the _Subscription filter name_ enter Papertrail\n6. Click _Start Streaming_  \n\nPaperWatch will now begin forwarding the functions logs to Papertrail\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigniant%2Fpaperwatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigniant%2Fpaperwatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigniant%2Fpaperwatch/lists"}