trentm / node-bunyan

a simple and fast JSON logging module for node.js services
Other
7.15k stars 513 forks source link

provide credentials by passing the username and password parameters for elastic user #707

Open rezacloner1372 opened 1 year ago

rezacloner1372 commented 1 year ago

how can I provide a username and password in my code? I don't find anything related to this

if (_.get(logConfig, 'elastic.enable')) {
  const Elasticsearch = require('bunyan-elasticsearch')
  const {Client} = require('elasticsearch')
  const client = new Client({host: logConfig.elastic.host})
  const {myindexMapping} = require('./util/mapping')

  const esStream = new Elasticsearch({
    indexPattern: '[myindex-]YYYY.MM.DD',
    type: 'logs',
    host: logConfig.elastic.host
  })