Winston Transport for Amazon SNS specialized for JSON logs in Sumo Logic
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Circle CI

An Amazon SNS transport for winston specialized for JSON logs in Sumo Logic.

Sumo Logic is not required to use this package if you only want to send nicely formatted JSON messages to Amazon SNS.

Requires Node.js v4.2.x or greater.


const winston = require('winston');
const WinstonSnsSumoLogic = require('winston-sns-sumo-logic');
const AWS = require('aws-sdk');

const sns = new AWS.SNS({
  region: '..',
  accessKeyId: '..',
  secretAccessKey: '..'

const options = {
  level: 'error',
  topicArn: '..'

winston.add(WinstonSnsSumoLogic, options);


  • level: Level of messages that should be logged. Defaults to info.
  • sns (required): The AWS.SNS instance to log to.
  • topicArn (required): The Amazon SNS topic ARN where the messages to be sent.
  • body: The base JSON message body. Should not contain timestamp, level, message, or meta. Forbidden fields will be overwritten.


Let's say options.body was configured to be

  model: 'Falcon 9',
  flight: 20

When the the following message is logged

const landingDetails = {
  location: {
    latitude: 28.4859,
    longitude: -80.5444
  fuel: 'nominal'
}'successful landing', landingDetails);

Then the resulting Amazon SNS message body would be

  "model": "Falcon 9",
  "flight": 20,
  "timestamp": 1450748385666,
  "level": "info",
  "message": "successful landing",
  "meta": {
    "location": {
      "latitude": 28.4859,
      "longitude": -80.5444
    "fuel": "nominal"

Where timestamp is the Unix Epoch in milliseconds when the message was logged.


There is another winston-sns transport, but it does not work well with Sumo Logic. That transport is focused on sending text based messaged to Amazon SNS, where as this transport focuses on sending JSON based messages with Sumo Logic compatible timestamps.


$ npm install winston-sns-sumo-logic --save

Sumo Logic Setup

  1. Create a Sumo Logic HTTP Collector
  2. Create a Amazon SNS topic
  3. Add Sumo Logic HTTP Collector endpoint as an HTTPS subscriber to the new topic
  4. Subscribe to SNS Notifications
  5. Enable Raw Message Delivery
  6. Add winston-sns-sumo-logic as a new transport
  7. Configure with topic ARN
  8. Ensure AWS Access Key has permission to publish messages to Amazon SNS

Author: Ronald Chen

License: MIT