当我转到该Analytics > Discover
部分时,日志会出现在我的索引模式搜索中,但不会出现在Observability > Logs
. 不知道我必须做什么才能让他们出现在那里。我已经application-*
在设置中添加了前缀。
1 回答
0
看起来弹性搜索的 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')
于 2021-04-26T13:20:26.967 回答