简体   繁体   English

无法将日志从 Hapi-Pino 发送到 Elasticsearch

[英]Can't send log from Hapi-Pino to Elasticsearch

  • I'm building server for a website use hapi and hapi-pino for logging.我正在为网站构建服务器,使用hapihapi-pino进行日志记录。
  • I want to analyze log (about status code, route, timestamp) for some business purpose.我想为某些业务目的分析日志(关于状态码、路由、时间戳)。 I use elasticsearch and kibana to do it我使用elasticsearchkibana来做
  • Between hapi-pino and Elasticsearch , I try to use pino-elasticsearch to send log.hapi-pinoElasticsearch之间,我尝试使用pino-elasticsearch elasticsearch 发送日志。 However, it didn't work, elasticsearch didn't get anything This is my code for registering hapi-pino:但是,它没有用,elasticsearch 没有得到任何东西这是我注册 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} http 客户端不信任此服务器的证书,关闭连接 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.当我尝试连接时,我收到这样的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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