user773737
user773737

Reputation:

How do I turn logging off for Elasticsearch in Node.js?

I'm using the elasticsearch npm module. I get annoying yellow warnings because my elasticsearch server is currently off.

How can I make it so that it doesn't log anything?

Upvotes: 11

Views: 5520

Answers (2)

Charlie Key
Charlie Key

Reputation: 3440

var client = new elasticsearch.Client({
  log : [{
    type: 'stdio',
    levels: ['error', 'warning'] // change these options
  }]
});

So if you just wanted errors showing up it would be.

var client = new elasticsearch.Client({
  log : [{
    type: 'stdio',
    levels: ['error'] // change these options
  }]
});

More can be found on config page. Different logging levels are found here (old link dead).

UPDATE: ES 7.x - logging has been removed: Breaking changes, Observability

Upvotes: 17

Benny Powers
Benny Powers

Reputation: 5836

I came to this thread because I was getting verbose logs for every elasticsearch query in the nodejs app I'm working on.

Turned out to be a package called elasticsearch-query-builder. It looks for an environment variable named VERBOSE_LOG, which I had to unset (i.e. to not set to false, which is a truthy string value)

Upvotes: 0

Related Questions