# simple-log-cloudwatch

> This library is useful to send logs to cloudwatch with nodejs

Latest version **1.0.8** (published 2021-01-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install simple-log-cloudwatch
pnpm add simple-log-cloudwatch
yarn add simple-log-cloudwatch
bun add simple-log-cloudwatch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2021-01-12 |
| First published | 2020-12-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Iván Cruz |
| Maintainers | ivan.crz |

## Links

- npm: https://www.npmjs.com/package/simple-log-cloudwatch
- Homepage: https://github.com/ivan-crz09/simple-log-cloudwatch
- npm.io page: https://npm.io/package/simple-log-cloudwatch

## Dependencies (1)

- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.817.0

## Recent versions

- 1.0.8 (latest) — 2021-01-12
- 1.0.7 — 2021-01-11
- 1.0.6 — 2020-12-31
- 1.0.5 — 2020-12-31
- 1.0.4 — 2020-12-30
- 1.0.3 — 2020-12-29
- 1.0.2 — 2020-12-29
- 1.0.1 — 2020-12-26
- 1.0.0 — 2020-12-26

## README

#  Simple Log Cloudwatch
This library is useful to send logs to cloudwatch. 

## Getting Started

### Installation
Install via NPM:
```
npm install simple-log-cloudwatch
```
 ---
### Using

 Import the package once it is installed

```
const { simpleLogCloudwatch }  =  require('simple-log-cloudwatch');
```

Next step is to set the credentials

```
const simpleLog = new simpleLogCloudwatch({
    logGroupName: 'xxxx', 
    region: 'xxxxx', 
    accessKeyId: 'xxxxx', 
    secretAccessKey: 'xxxxxxxx',
    apiVersionCloudwatch: 'xxxxxx'
});

```

===========================================

You need to create the **Log Group** inside of [AWS](https://console.aws.amazon.com/). 

===========================================


Finally to save the logs in **Cloudwatch** you need to invoke the function **createLog** and pass **two parameters**

===========================================
##### Log Stream
*type*: String

*value*: Name of the Log Event (Example: '29-12-2020')

##### Messages
*type*: Array of String

*value*: Messages that will be send it to Cloudwatch

===========================================

```
simpleLog.createLog("29-12-2020",["test-message-1","test-message-2"])
```

---
#### Example
```
//import 
const { simpleLogCloudwatch }  =  require('simple-log-cloudwatch');

//set the credentials of aws
const simpleLog = new simpleLogCloudwatch({
    logGroupName: 'xxxx', 
    region: 'xxxxx', 
    accessKeyId: 'xxxxx', 
    secretAccessKey: 'xxxxxxxx',
    apiVersionCloudwatch: 'xxxxxx'
});


//create the logs
simpleLog.createLog("01-01-2020",["test-message-1","test-message-2"])
```
---
### Additional Info

 - You need to have the permission to *create* **Log Stream** in **Cloudwatch**
 - You need to have the permission to *put* **Log Events** in **Cloudwatch**
 - You need to create **first** the **Log Group** inside of [AWS](https://console.aws.amazon.com/)

---
_Source: https://npm.io/package/simple-log-cloudwatch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
