pino-https-aws-signed

Fork of @technicallyjosh/pino-http-send for handling sending logs in HTTPS through AWS Signed requests.

Usage no npm install needed!

<script type="module">
  import pinoHttpsAwsSigned from 'https://cdn.skypack.dev/pino-https-aws-signed';
</script>

README

pino-https-aws-signed

A basic handler for pino logs that sends batches to a desired endpoint via AWS signed requests, forked from @technicallyjosh/pino-http-send repository.

Installation

$ npm i pino-https-aws-signed

API

You can use this module as a pino destination.

This will use the same batching function like the CLI usage. If the batch length is not reached within a certain time (timeout), it will auto "flush".

createWriteStream

The options passed to this follow the same values as the CLI defined above.

Property Type Required/Default
elkRole string REQUIRED
elkRoleSessionName string REQUIRED
elkDomain string REQUIRED
elkRegion string REQUIRED
elkIndex string REQUIRED
elkDoctype string REQUIRED
batchSize number 10
timeout number 5000
const {createWriteStream} = require('../pino-https-aws-signed');

const stream = createWriteStream({
    elkRole: process.env.ROLE, 
    elkRoleSessionName: process.env.ROLE_SESSION_NAME,
    elkDomain: process.env.ES_DOMAIN,
    elkRegion: process.env.ELK_REGION,
    elkIndex: process.env.ELK_INDEX,
    elkDocType: process.env.ELK_DOC_TYPE
});

const logger = Pino(
    {
        level: 'info',
    },
    stream,
);