@elastic/ecs-winston-format
TypeScript icon, indicating that this package has built-in type declarations

1.5.3 • Public • Published

@elastic/ecs-winston-format

npm test

This Node.js package provides a formatter for the winston logger compatible with Elastic Common Schema (ECS) logging. In combination with the filebeat shipper, you can send your logs directly to Elasticsearch and leverage Kibana's Logs app to inspect all logs in one single place.

winston 3.x versions are supported.

Please see the Node.js ECS winston documentation.

Install

npm install @elastic/ecs-winston-format

Usage

const winston = require('winston');
const { ecsFormat } = require('@elastic/ecs-winston-format');

const logger = winston.createLogger({
  level: 'info',
  format: ecsFormat(/* options */),
  transports: [
    new winston.transports.Console()
  ]
});

logger.info('hi');
logger.error('oops there is a problem', { foo: 'bar' });

Running this script will produce log output similar to the following:

% node examples/basic.js
{"@timestamp":"2021-01-13T21:32:38.095Z","log.level":"info","message":"hi","ecs":{"version":"8.10.0"}}
{"@timestamp":"2021-01-13T21:32:38.096Z","log.level":"error","message":"oops there is a problem","ecs":{"version":"8.10.0"},"foo":"bar"}

Please see the Node.js ECS winston documentation for more.

License

This software is licensed under the Apache 2 license.

Package Sidebar

Install

npm i @elastic/ecs-winston-format

Weekly Downloads

71,819

Version

1.5.3

License

Apache-2.0

Unpacked Size

28.7 kB

Total Files

5

Last publish

Collaborators

  • lenegadewoll
  • cbishopewc
  • cindy_c
  • asnyder-elastic
  • lgestc
  • patryk.kopycinski
  • banerjeesoham004
  • legrego
  • bradtimmerman
  • devcorpio
  • yan.savitski
  • jeramysoucy
  • tkajtoch
  • johnwcambra
  • colleen.mcginnis
  • scottybollinger
  • kyrspl
  • phoey1
  • verogo
  • breehall
  • trevorpierce
  • glitteringkatie
  • jen-huang
  • delvedor
  • lukasolson
  • ccowan
  • jbudz
  • thomasneirynck
  • weltenwort
  • pugnascotia
  • zinckiwi
  • brandon.kobel
  • nreese
  • mgreau
  • jonahbull
  • jarpy
  • leathekd
  • lukeelmers
  • ddillinger
  • joshdover
  • jasonstoltz
  • bamieh
  • markov00
  • joshmock
  • vignesh.shanmugam
  • watson
  • rhodesjason
  • jmlrt
  • mattkime
  • constancecchen
  • afoucret
  • nickpeihl
  • axw
  • mistic
  • elasticmachine
  • gtback
  • pickypg
  • trentm
  • andrewvc-elastic
  • jorge.sanz
  • stratoula
  • nkammah
  • streamich
  • nickofthyme
  • chloeruka