Skip to content

Commit

Permalink
Merge pull request #1199 from jertel/log
Browse files Browse the repository at this point in the history
add log line when exiting due to --end param falling in the past
  • Loading branch information
jertel authored Jun 9, 2023
2 parents 00874ee + 44606c9 commit 5acbb9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Add support for Kibana 8.8 for Kibana Discover - [#1184](https://github.com/jertel/elastalert2/pull/1184) - @nsano-rururu
- Upgrade pylint 2.17.0 to 2.17.4, pytest 7.2.2 to 7.3.1, pytest-xdist 3.2.0 to 3.3.1, sphinx 6.1.3 to 6.2.1, sphinx_rtd_theme == 1.2.2 - [#1194](https://github.com/jertel/elastalert2/pull/1194) - @nsano-rururu
- Upgrade to Tox 4 - [#1196](https://github.com/jertel/elastalert2/pull/1196) - @jertel
- Log message when exiting due to --end param being in the past - [#1199](https://github.com/jertel/elastalert2/pull/1199) - @jertel

# 2.11.0

Expand Down
4 changes: 3 additions & 1 deletion elastalert/elastalert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,9 @@ def start(self):
if self.args.end:
endtime = ts_to_dt(self.args.end)

if next_run.replace(tzinfo=dateutil.tz.tzutc()) > endtime:
next_run_dt = next_run.replace(tzinfo=dateutil.tz.tzutc())
if next_run_dt > endtime:
elastalert_logger.info("End time '%s' falls before the next run time '%s', exiting." % (endtime, next_run_dt))
exit(0)

if next_run < datetime.datetime.utcnow():
Expand Down

0 comments on commit 5acbb9d

Please sign in to comment.