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

1.5.0 • Public • Published

@elastic/ecs-pino-format

npm test

This Node.js package provides a formatter for the pino 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.

pino 6.x, 7.x, and 8.x versions are supported.

Please see the Node.js ECS pino documentation.

Install

npm install @elastic/ecs-pino-format

Usage

This package will configure Pino's formatters, messageKey and timestamp options.

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

const log = pino(ecsFormat(/* options */))
log.info('Hello world')

const child = log.child({ module: 'foo' })
child.warn('From child')

Running this will produce log output similar to the following:

{"log.level":"info","@timestamp":"2023-10-16T18:08:02.601Z","process.pid":74325,"host.hostname":"pink.local","ecs.version":"8.10.0","message":"Hello world"}
{"log.level":"warn","@timestamp":"2023-10-16T18:08:02.602Z","process.pid":74325,"host.hostname":"pink.local","ecs.version":"8.10.0","module":"foo","message":"From child"}

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

License

This software is licensed under the Apache 2 license.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.5.0
    183,621
    • latest

Version History

Package Sidebar

Install

npm i @elastic/ecs-pino-format

Weekly Downloads

316,115

Version

1.5.0

License

Apache-2.0

Unpacked Size

24.8 kB

Total Files

5

Last publish

Collaborators

  • 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