Express middleware to log messages to Loggly

Usage no npm install needed!

<script type="module">
  import onenorthExpressLogglyIis from 'https://cdn.skypack.dev/@onenorth/express-loggly-iis';


Express | Loggly IIS

A module that sends logging information to your Loggly instance.


Here's how to set up Loggly IIS with your existing Express server:

  1. Run: npm install --save @onenorth/express-loggly-iis

  2. Add app.use(expressLogglyIIS) before all of your routes.

const express = require('express')
const expressLogglyIIS = require('express-loggly-iis')

const app = express()

// !!! Important for logging IP addresses on Heroku !!!
app.set('trust proxy', true)


app.get('/', (req, res) => res.send('home'))
app.get('/people', (req, res) => res.send('people'))
app.get('/services', (req, res) => res.send('services'))

app.listen(3000, () => console.info('ready on port 3000'))


To configure this with your Express instance, please use the following environment variables:


Example: 12345678-1234-1234-1234-1234567890AB

The customer token generated from Loggly. Find out more about how to create a token here.

LOGGLY_TAGS (Required)

Example: iis,onenorth

A comma-separated list of tags you want to use for filtering logs.

Please add in your site's tag, along with iis.

LOGGLY_SUBDOMAIN (Defaults to logs-01)

Example: logs-01

The subdomain associated with Loggly (you can leave this alone).

The subdomain option is only here in case hosting decides to change their standard endpoint.