While setting up elastalert2 via a python package, after configuring the rule, and testing it I am getting error : "AttributeError: module 'datetime' has no attribute 'UTC' ".
root@server01:~# elastalert-test-rule test_rule.yml
Traceback (most recent call last):
File "/usr/local/bin/elastalert-test-rule", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.10/dist-packages/elastalert/test_rule.py", line 510, in main
test_instance = MockElastAlerter(args)
File "/usr/local/lib/python3.10/dist-packages/elastalert/test_rule.py", line 174, in init
self.ts_now = ts_now()
File "/usr/local/lib/python3.10/dist-packages/elastalert/util.py", line 212, in ts_now
now = datetime.datetime.now(tz=datetime.UTC)
AttributeError: module 'datetime' has no attribute 'UTC'
please find the contents of test_rule.yml
index: pglogs-*
type: frequency
num_events: 15
timeframe:
hours: 4
filter:
While setting up elastalert2 via a python package, after configuring the rule, and testing it I am getting error : "AttributeError: module 'datetime' has no attribute 'UTC' ".
root@server01:~# elastalert-test-rule test_rule.yml Traceback (most recent call last): File "/usr/local/bin/elastalert-test-rule", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.10/dist-packages/elastalert/test_rule.py", line 510, in main
test_instance = MockElastAlerter(args)
File "/usr/local/lib/python3.10/dist-packages/elastalert/test_rule.py", line 174, in init
self.ts_now = ts_now()
File "/usr/local/lib/python3.10/dist-packages/elastalert/util.py", line 212, in ts_now
now = datetime.datetime.now(tz=datetime.UTC)
AttributeError: module 'datetime' has no attribute 'UTC'
please find the contents of test_rule.yml
index: pglogs-* type: frequency num_events: 15 timeframe: hours: 4 filter: