Configure log4j to hide WARN in elasticsearch

Hi everyone!
I'm using elasticsearch v 7.1 and v 6.2 and I'm trying to configure elastic log via file to show only info and errors, and hide the warnings.
How do I do that?
I tried to read the apchee page but I didn't see any direct refrence to this issue or to configuring via file.
I looked at the elastic page -
and didn't find any answers there either.

I only changed the line: = org.elasticsearch.action
logger.action.level = debug

to: = org.elasticsearch.action
logger.action.level = error

But it didn't work.
What to I need to change or add in order to make sure that elastic report only on the ERROR and INFO levels, and not WARN?

I don't think it is possible. Logging levels are linear, and to set the logging level to info, it will always include warn and error.

Note that the logger you changed is just a child logger for actions, not for the entire log.

Actually, it could be done, but you would need to write your own log4j appender to customize not propagate warn messages.

However, this is really not recommended. Why do you want to omit warning messages? They are important, and ignoring them can lead to problems later, like when upgrading.

Because in my application sometimes I send a request to delete a non existing index, and the error stack from this action fills up my logs.

Why not change your code to check if the index exists before deleting it?

1 Like

If you are deleting with a wildcard or multiple indices at the same time, you can use the following options:

It might help.

If it's a specific index you want to delete, just do what @Christian_Dahlqvist proposed.

I use the wildcard, the error I get is a wildcard expetion, index does not exist.

org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.indexNotFoundException( ~[elasticsearch-7.1.0.jar:7.1.0]

Anyway, I understand that there is no way to avoid this warning without changing the way my app sends requests...

Can you share exactly what you are doing, like the code?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.