- I'm building server for a website use
hapi
andhapi-pino
for logging. - I want to analyze log (about status code, route, timestamp) for some business purpose. I use
elasticsearch
andkibana
to do it - Between
hapi-pino
andElasticsearch
, I try to usepino-elasticsearch
to send log. However, it didn't work, elasticsearch didn't get anything This is my code for registering hapi-pino:
const streamToElastic = PinoElasticsearch({
index: 'api',
type: 'log',
consistency: 'one',
node: 'http://elastic:changeme@localhost:9200',
'es-version': 6,
'bulk-size': 200,
ecs: true
});
await server.register({
plugin: HapiPino,
options: {
logPayload: true,
prettyPrint: process.env.NODE_ENV !== 'production',
redact: {
paths: ['req.headers', 'payload.user.password', 'payload.file'],
remove: true
},
stream: streamToElastic
}
});
Thanks for any helps and sorry about my poor English!