[英]Elastic cloud logs not appearing in observability logs
看起来弹性搜索的 Pino 记录器默认不再使用ecs format
对其进行格式化。 所以我必须启用它才能让它工作。
弹性云服务器支持
如果你想使用 Elastic Common Schema,你应该安装@elastic/ecs-pino-format,因为这个模块的 ecs 选项已经被移除了。
const pino = require('pino')
const ecsFormat = require('@elastic/ecs-pino-format')()
const pinoElastic = require('pino-elasticsearch')
const streamToElastic = pinoElastic({
index: 'an-index',
consistency: 'one',
node: 'http://localhost:9200',
'es-version': 7,
'flush-bytes': 1000
})
const logger = pino({ level: 'info', ...ecsFormat }, streamToElastic)
logger.info('hello world')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.