JSPM

@elastic/ecs-morgan-format

0.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2899
  • Score
    100M100P100Q136414F
  • License Apache-2.0

A formatter for the morgan logger compatible with Elastic Common Schema.

Package Exports

  • @elastic/ecs-morgan-format

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@elastic/ecs-morgan-format) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@elastic/ecs-morgan-format

Build Status js-standard-style

A formatter for the morgan logger compatible with Elastic Common Schema.
In combination with filebeat you can send your logs directly to Elasticsearch and leverage Kibana's Logs UI to inspect all logs in one single place.


Please note that this library is in a beta version and backwards-incompatible changes might be introduced in future releases. While we strive to comply to semver, we can not guarantee to avoid breaking changes in minor releases.


Install

npm i @elastic/ecs-morgan-format

Usage

const app = require('express')()
const morgan = require('morgan')
const ecsFormat = require('@elastic/ecs-morgan-format')()

app.use(morgan(ecsFormat))

app.get('/', function (req, res) {
  res.send('hello, world!')
})

app.listen(3000, () => {
  console.log('Listening')
})

Options

You can pass any format option you would normally pass to morgan, and the log message will use the specified format (the default is combined).

const app = require('express')()
const morgan = require('morgan')
const ecsFormat = require('@elastic/ecs-morgan-format')('tiny')
app.use(morgan(ecsFormat))

License

This software is licensed under the Apache 2 license.