{"id":19680034,"url":"https://github.com/fsobh/aws-logging","last_synced_at":"2026-02-14T16:01:35.172Z","repository":{"id":43410543,"uuid":"463056261","full_name":"fsobh/aws-logging","owner":"fsobh","description":"A logging utility that is used to track activity of multiple API services hosted on a single AWS Account. Has ability to send Email Notifications with severity levels configured.","archived":false,"fork":false,"pushed_at":"2022-03-02T20:29:01.000Z","size":89,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T01:56:08.340Z","etag":null,"topics":["aws","dynamodb","lambda","logger","nodejs","ses","sns","utility"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/aws-logging","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fsobh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-24T07:52:14.000Z","updated_at":"2022-05-06T16:24:33.000Z","dependencies_parsed_at":"2022-08-28T11:11:41.168Z","dependency_job_id":null,"html_url":"https://github.com/fsobh/aws-logging","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fsobh/aws-logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsobh%2Faws-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsobh%2Faws-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsobh%2Faws-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsobh%2Faws-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fsobh","download_url":"https://codeload.github.com/fsobh/aws-logging/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsobh%2Faws-logging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29448922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["aws","dynamodb","lambda","logger","nodejs","ses","sns","utility"],"created_at":"2024-11-11T18:03:39.227Z","updated_at":"2026-02-14T16:01:35.151Z","avatar_url":"https://github.com/fsobh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://aws.amazon.com\" title=\"AWS\"\u003e\n        \u003cimg  height=230px src=\"https://pbs.twimg.com/profile_images/1473756532827246593/KRgw2UkV_400x400.jpg\" alt=\"AWS\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n# aws-logging\n### Logs activity across all services under a single AWS account. Optional features can be enabled to trigger Email notifications based on the logs severity level.\n\n\n[![JavaScript](https://img.shields.io/badge/JavaScript-%23FFFF00)](https://img.shields.io/badge/JavaScript-%23FFFF00)    [![Node](https://img.shields.io/badge/NodeJS-v14.0.1-brightgreen)](https://img.shields.io/badge/NodeJS-v14.x.x-brightgreen) \n [![AWS](https://img.shields.io/badge/AWS-Cloud%20provider-orange)](https://img.shields.io/badge/AWS-Cloud%20provider-orange)\n[![Dynamo](https://img.shields.io/badge/DynamoDB-Database-blue)](https://img.shields.io/badge/DynamoDB-Database-blue) [![Lambda](https://img.shields.io/badge/Lambda-service-%20%09%23a26c2f)](https://img.shields.io/badge/Lambda-service-%20%09%23a26c2f)  [![SES](https://img.shields.io/badge/SES-aws--sdk-yellowgreen)](https://img.shields.io/badge/SES-aws--sdk-yellowgreen)\n\u003c/div\u003e\n\n\n## Installation\n####  Install the Package\n\n```bash\n  npm install aws-logging\n```\n\n## Import the module\n\n```javascript\n let Logger = require('aws-logging');\n```\n\n## Configure your logger\n\n```javascript\n Logger.config.update(\n    {\n        tableName : \"SERVICE-LOGS\",  \n        mailList : [\"example@icloud.com\"],\n        stage : \"Dev\",\n        mailSubject : \"New AWS Log\",\n        sourceEmail : \"example@yourVerifiedEmailOrDomain.com\",\n        notifyOnSeverityLevel : 10,\n        serviceName : \"sample-service\",\n        enableNotifications : false,\n        region : \"us-east-2\",\n        accessKeyId : \"xxxx\",\n        secretAccessKey : \"xxxx\"\n\n    });\n```\n# IMPORTANT :\n\n### Make sure the IAM role has the following permissions enabled on AWS AND in your app.\n(The role you generated your  Access Key  and Secret from)\n\n```yaml\n  iamRoleStatements:\n    - Effect: \"Allow\"\n      Action:\n        - \"logs:*\"\n      Resource: \"*\" \n    - Effect: \"Allow\"\n      Action:\n        - \"dynamodb:*\"\n      Resource: \"*\"\n    - Effect: \"Allow\"\n      Action: \"ses:ListIdentities\"\n      Resource: \"*\" \n    - Effect: \"Allow\"\n      Action: \"ses:SendEmail\"\n      Resource: \"*\"\n```\n\n| Parameter | Type     | Description                       |\n| :-------- | :------- | :-------------------------------- |\n| `tableName`      | `String`| **Required**. The name of the table that will be automatically created to store your logs. Defaults to `\"SERVICE-LOGS\"`. Must be unique from other table names. |\n| `mailList`       | `Array` | **Optional**. A list of recipient emails that will recieve log alerts |\n| `mailSubject`     | `String` | **Optional**. The email subject to be displayed for recipients when they recieve a log alert. Defaults to `\"New AWS Log\"`  |\n| `sourceEmail`     | `String` | **Optional**. The sender email used to send the logs.  **Must be a verified email in your AWS account or under a verified Domain** |\n| `notifyOnSeverityLevel`     | `Integer` | **Required**. The severity level a log must have in order to trigger an email alert. Defaults to `10`. (max 10 - min 0) |\n| `serviceName`     | `String` | **Required**. The name of the service you added this package to. This will be used to identify which service the log belongs to in the `SERVICE-LOGS` table |\n| `enableNotifications`     | `Boolean` | **Optional**. Specify if you want email alerts enabled. **Note : If set to `true`, The following fields will be required : `mailList`, and `sourceEmail`** . |\n| `region`     | `String` | **Required** . The AWS region you want this Logger configured for. **Note : Must be the same as the region that the `sourceEmail` is configured for in your AWS account**  |\n| `accessKeyId`     | `String` | **Required** . Your AWS IAM access Key. Not required if you dont have to configure this before using `aws-sdk` in your service  |\n| `secretAccessKey`     | `String` | **Required** . Your AWS IAM secret Key. Not required if you dont have to configure this before using `aws-sdk` in your service  |\n\n\n## Usage\n| Parameter | Type     | Description                       |\n| :-------- | :------- | :-------------------------------- |\n| `message`      | `String`| **Required**. The message you want to log |\n| `severity`       | `Array` | **Optional**. Severity level (max 10 - min 0). **Defaults : `{Log : 1 , Warn : 2 , Error : 3}`** |\n| `details`     | `JSON Object` | **Optional**. Any additional details you may want to add. **Defaults to false**  |\n\n### Partial example from this [example app](https://github.com/fsobh/Chainlink-External-Initiator-Template/blob/Dev/app.js)\n\n```javascript\nvar express = require('express');\nconst serverless = require('serverless-http');\nvar app = express();\napp.use(express.urlencoded({ extended: true }));\napp.use(express.json());\nconst Logger = require(\"aws-logging\");\n\nLogger.config.update({\n  \n    mailList : [process.env.RECIEVER_EMAIL_1],\n    sourceEmail : process.env.SOURCE_EMAIL,\n    notifyOnSeverityLevel : 5,\n    serviceName : process.env.SERVICE_NAME,\n    enableNotifications : true,\n    region:\"us-east-2\",\n    accessKeyId : process.env.KEY,\n    secretAccessKey : process.env.SECRET\n\n})\napp.get('/', async function (req, res) {\n\n    try {\n\n        await Logger.log(\"Health Check ran\", 1, {request : {body : JSON.parse(JSON.stringify(req.body))}});\n        res.sendStatus(200);\n        \n    } catch (error) {\n        \n        await Logger.error(error.message,3,\n            {\n                stack : error.stack,\n                error : String(error)\n            });\n        res.send({'error' : error}).sendStatus(500);\n    }\n\n})\n\nmodule.exports.handler = serverless(app);\n```\n\n\n\n####  Log\n```javascript\n await Logger.log(\"Logging data\");\n //or\n await Logger.log(\"Logging data\", 1);\n //or\n await Logger.log(\"Logging data\", 1 , {attribute1 : \"1\", attribute1 : \"2\", }); \n```\n\n####  Warn\n```javascript\n await Logger.warn(\"Warning data\");\n //or\n await Logger.warn(\"Warning data\", 2);\n //or\n await Logger.warn(\"Warning data\", 2 , {attribute1 : \"1\", attribute1 : \"2\", }); \n```\n\n####  Error\n```javascript\n await Logger.error(\"Error data\");\n //or\n await Logger.error(\"Error data\", 3);\n //or\n await Logger.error(\"Error data\", 3 , {attribute1 : \"1\", attribute1 : \"2\", });  \n```\n\n### Short Methods\nThese shorter methods just swap the argument order for details and severity.\n\n####  Log\n```javascript\n await Logger.l(\"Log data\");\n //or\n await Logger.l(\"Log data with object\", {attribute1 : \"1\", attribute1 : \"2\", });\n //or\n await Logger.l(\"Log data with object and sev\", {attribute1 : \"1\", attribute1 : \"2\", }, 1);  \n```\n####  Warn\n```javascript\n await Logger.w(\"Warn data\");\n //or\n await Logger.w(\"Warn data with object\", {attribute1 : \"1\", attribute1 : \"2\", });\n //or\n await Logger.w(\"Warn data with object and sev\", {attribute1 : \"1\", attribute1 : \"2\", }, 2);  \n```\n####  Error\n```javascript\n await Logger.e(\"Error data\");\n //or\n await Logger.e(\"Error data with object\", {attribute1 : \"1\", attribute1 : \"2\", });\n //or\n await Logger.e(\"Error data with object and sev\", {attribute1 : \"1\", attribute1 : \"2\", }, 3);  \n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffsobh%2Faws-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffsobh%2Faws-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffsobh%2Faws-logging/lists"}