elastalert icon indicating copy to clipboard operation
elastalert copied to clipboard

Logging issues

Open Salaander opened this issue 7 years ago • 3 comments

I noticed that in alerts.py there is an import logging that was in the Initial commit yet it is not set up and only used 7 times: 6 times in JiraAlerter and once in CommandAlerter. In JiraAlerter.alert() it is even used in the same function where elastalert_logger is also used.

I just wanted to ask if anybody else noticed these issues and to ask if you would be cool to remove the import logging and the 7 occurrences should be swapped to elastalert_logger references. For some reason I cannot even see the logs from alerter.py even is they are called on the elastalert_logger instance and --verbose is set but I am debugging it.

Salaander avatar Feb 01 '19 14:02 Salaander

The bare logging also used 4 times in the config.py that will never be displayed. I will push another PR where I try to find all the occurences later, but I wanted to fix the JiraAlerter as soon as I could since we use it heavily and got no logs from it.

Salaander avatar Feb 02 '19 19:02 Salaander

I can confirm that the JiraAlerter log messages started to show up in the log now for us with this PR.

Salaander avatar Feb 04 '19 16:02 Salaander

grep -rnI --exclude-dir=build 'logging.error' * | wc -l
12
grep -rnI --exclude-dir=build 'logging.warning' * | wc -l
7

I know that the root logger's log level by default is WARNING so these messages will be seen (even if the --verbose is not used), but I would still suggest to use the logger we create, it makes log formatting and handling more uniform and easy. That is just a suggestion though.

grep -rnI --exclude-dir=build 'logging.debug' * | wc -l
4
grep -rnI --exclude-dir=build 'logging.info' * | wc -l
1

These will never appear however.

Salaander avatar Feb 04 '19 16:02 Salaander