-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'dict' when running my custom rule #1727
Comments
parser.parse works for strings only, assuming that's dateutil.parser. Though, you didn't post the traceback so I don't even know where the error occurred. The timestamp should have been converted to a datetime object before anyway. Also, you could remove all the string replacement stuff and just do |
Thanks Qmando, I tried this solution but it was not working, might be I was putting the parsing code in wrong place. Not sure. |
I think I was able to solve it. The attribute 'query_delay' was missing in the rule.yaml file, after placing it the issue was resolved. Can you please describe regarding 'query_delay'. Thanks. I have one more question the rule that I am running using elastalert is continuously running for hours. Is there a way for the rule to execute/check once and then stop ? |
You can give a query_delay simple moves all queries back in time by that amount. For example, a five minute delay would cause queries at 12:00 to end at 11:55 instead of going up to the present time. |
Hi
The custom rule runs fine using elastalert-test-rule but when running using python -m elastalert.elastalert it gives the below error -
Getting TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'dict'
Below is the custom timestamp used:
timestamp_field: Timestamp
timestamp_format: '%Y-%m-%dT%H:%M:%S.%fZ'
Here is the add_data function my_rule python script..
def add_data(self, data):
Thanks in advance guys..
The text was updated successfully, but these errors were encountered: