简体   繁体   中英

Can't send log from Hapi-Pino to Elasticsearch

  • I'm building server for a website use hapi and hapi-pino for logging.
  • I want to analyze log (about status code, route, timestamp) for some business purpose. I use elasticsearch and kibana to do it
  • Between hapi-pino and Elasticsearch , I try to use pino-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!

http client did not trust this server's certificate, closing connection Netty4HttpChannel{localAddress=/[0:0:0:0:0:0:0:1]:9200, remoteAddress=/[0:0:0:0:0:0:0:1]:59763}

I am getting error like this when I try to connect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM