{"id":18264047,"url":"https://github.com/biggaji/send-cloudwatch-log","last_synced_at":"2025-04-04T20:31:31.371Z","repository":{"id":44888423,"uuid":"447681538","full_name":"biggaji/send-cloudwatch-log","owner":"biggaji","description":"Easily send logs from your Node.js application to AWSCloudWatchLogs service","archived":false,"fork":false,"pushed_at":"2023-11-15T10:50:28.000Z","size":53,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-15T17:07:57.387Z","etag":null,"topics":["aws","biggaji","cloudwatch-logs","send-cloudwatch-log"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/send-cloudwatch-log","language":"TypeScript","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/biggaji.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}},"created_at":"2022-01-13T17:00:08.000Z","updated_at":"2024-04-23T19:57:22.000Z","dependencies_parsed_at":"2024-11-05T11:15:38.406Z","dependency_job_id":"a219f7f9-67b3-465a-8e95-23f6ab5853ea","html_url":"https://github.com/biggaji/send-cloudwatch-log","commit_stats":null,"previous_names":["biggaji/aws-cw-logger"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggaji%2Fsend-cloudwatch-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggaji%2Fsend-cloudwatch-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggaji%2Fsend-cloudwatch-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggaji%2Fsend-cloudwatch-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biggaji","download_url":"https://codeload.github.com/biggaji/send-cloudwatch-log/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247246426,"owners_count":20907799,"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","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","biggaji","cloudwatch-logs","send-cloudwatch-log"],"created_at":"2024-11-05T11:13:35.186Z","updated_at":"2025-04-04T20:31:29.911Z","avatar_url":"https://github.com/biggaji.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# send-cloudwatch-log\n\nThis sdk allows you to easily send logs from your Node.js application to\nAWSCloudWatchLogs service. It is easy and very simple to use.\n\n## Requirement\n\nThis sdk requires a node version 8, 10 or higher to work effectively.\n\n## Installation\n\nUsing Npm?\n\n```sh\nnpm install --save send-cloudwatch-log\n```\n\nUsing Yarn?\n\n```sh\nyarn add send-cloudwatch-log\n```\n\n## Usage\n\n```js\nconst cwlogger = require('send-cloudwatch-log');\n\n// Create an instance of the cwlogger , you can create as many instance as you want.\n// For each instance, you just need to pass the required configs details as seen in the example below:\nconst logger = new cwlogger(\n  {\n    accessKeyId: 'AWS_ACCESS_KEY_ID',\n    secretAccessKey: 'AWS_SECRET_ACCESS_KEY',\n    region: 'AWS_REGION',\n  },\n  {\n    logGroupName: 'LOG_GROUP_NAME',\n    logStreamName: 'LOG_STREAM_NAME',\n  },\n);\n\n/**\n * Create a log object\n * Each log object must contain only the 'message' and 'timestamp' properties.\n * { message: string, timestamp: number}\n * Since message must be a string, so you can also use the JSON.stringify() method to wrap objects as a string\n * timestamp must be in milliseconds, so you can use either Date.now() or new Date().getTime();\n */\n\nlet log = {\n  message: 'Hello World from cwLogger',\n  timestamp: Date.now(),\n};\n\n\n// Send log to AWSCloudWatchLogs\n// The sendLog() method accepts either a single log object or an array of log objects.\n\n// Sending the a single log object\nlogger\n  .sendLog(log)\n  .then((resp) =\u003e {\n     // resp -\u003e the response from AWSCloudWatchLogs\n    console.log(`Logs sent successfully`, resp);\n  })\n  .catch((err) =\u003e {\n    console.log(`An error occured`, err);\n  });\n\n\nlet logs = [\n  {\n    message: 'Hello World from cwLogger',\n    timestamp: Date.now(),\n  };\n  {\n    message: JSON.stringify({ error: 'TypeError', message: 'timestanps must be a number'}),\n    timestamp: Date.now(),\n  };\n];\n\n// Sending the an array | list of log object\nlogger\n  .sendLog(logs)\n  .then((resp) =\u003e {\n    // resp -\u003e the response from AWSCloudWatchLogs\n    console.log(`Logs sent successfully`, resp);\n  })\n  .catch((err) =\u003e {\n    console.log(`An error occured`, err);\n  });\n```\n\nThe `sendLog()` method takes the log object or an array of log objects as an\nargument and sends it to the AWSCloudWatchLogs.\n\nIt returns a promise which when successful, returns an object which contains a\nnextSequenceToken and $metadata from AWSCloudWatchLogs or an error with a\nmessage showing the reason it failed.\n\n![Image Screenshot of AwsCloudWatchLogs stream event](https://res.cloudinary.com/dahn8uiyc/image/upload/v1642677223/logger_baqit9.png)\n\n## How can I thank you?\n\nWhy not star the Github repository? I'd love the attention!\n\nWhy not share the link for this repository on X or HackerNews?\n\nSpread the word!\n\nDon't forget to [follow me on X](https://x.com/oxwware)!\n\nThanks!\n\nTobiloba Ajibade.\n\n## License\n\nThe MIT License [(MIT)](\"https://mit-license.org/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiggaji%2Fsend-cloudwatch-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiggaji%2Fsend-cloudwatch-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiggaji%2Fsend-cloudwatch-log/lists"}