Getting an exception while fetching JSON log from Datadog
We are having JSON and RAW logs pushed to Datadog from our application. While fetching RAW log using list_logs_get method, it is able to fetch successfully whereas the API call throws exception with JSON logs.
severity/high
To Reproduce
Steps to reproduce the behavior:
- Upload JSON logs to Datadog
- Fetch logs using list_logs_get method in Python client with filter_from and filter_to parameters
- Getting below exceptions:
calendar.IllegalMonthError: bad month number 0; must be 1-12
Expected behavior
It should work similarly to RAW logs
Screenshots
NA
Environment and Versions (please complete the following information):
A clear and precise description of your setup:
Exception Logs
filter_query=@cliIP:198.18.39.124, filter_index=main, filter_from=2021-09-07 11:01:28+00:00, filter_to=2021-09-07 12:47:17+00:00, sort=timestamp, page_limit=1000
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api_client.py:787: UserWarning: Using unstable operation 'list_logs_get'
warnings.warn("Using unstable operation '{0}'".format(self.settings["operation_id"]))
Exception occured: unsupported operand type(s) for +: 'int' and 'str'
Retrying with different search filter: @accLang:DATADOG_PERF_TEST_0907123306%20SPACE%20IN%20THE%20ACCEPT%20LANGUAGE
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 655, in parse
ret = self._build_naive(res, default)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 1238, in _build_naive
if cday > monthrange(cyear, cmonth)[1]:
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/calendar.py", line 124, in monthrange
raise IllegalMonthError(month)
calendar.IllegalMonthError: bad month number 0; must be 1-12
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/vechandr/git_repo/mdsqa_python3_automation/DSL_Automation/util/DatadogUtil.py", line 50, in fetch_data_from_datadog
api_response = api_instance.list_logs_get(filter_query=filter_query, filter_index=filter_index, filter_from=filter_from, filter_to=filter_to, sort=sort, page_limit=page_limit)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api/logs_api.py", line 307, in list_logs_get
return self._list_logs_get_endpoint.call_with_http_info(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api_client.py", line 844, in call_with_http_info
return self.api_client.call_api(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api_client.py", line 386, in call_api
return self.__call_api(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api_client.py", line 214, in __call_api
return_data = self.deserialize(response_data, response_type, _check_type)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api_client.py", line 307, in deserialize
deserialized_data = validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1552, in validate_and_convert_types
converted_instance = attempt_convert_item(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1439, in attempt_convert_item
return deserialize_model(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1355, in deserialize_model
return model_class._new_from_openapi_data(**kw_args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 313, in _new_from_openapi_data
return cls._from_openapi_data(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model/logs_list_response.py", line 140, in _from_openapi_data
self = super(LogsListResponse, cls)._from_openapi_data(kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 583, in _from_openapi_data
setattr(self, var_name, var_value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 168, in setattr
self[attr] = value
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 509, in setitem
self.set_attribute(name, value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 137, in set_attribute
value = validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1602, in validate_and_convert_types
validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1552, in validate_and_convert_types
converted_instance = attempt_convert_item(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1439, in attempt_convert_item
return deserialize_model(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1355, in deserialize_model
return model_class._new_from_openapi_data(**kw_args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 313, in _new_from_openapi_data
return cls._from_openapi_data(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model/log.py", line 138, in _from_openapi_data
self = super(Log, cls)._from_openapi_data(kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 583, in _from_openapi_data
setattr(self, var_name, var_value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 168, in setattr
self[attr] = value
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 509, in setitem
self.set_attribute(name, value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 137, in set_attribute
value = validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1552, in validate_and_convert_types
converted_instance = attempt_convert_item(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1439, in attempt_convert_item
return deserialize_model(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1355, in deserialize_model
return model_class._new_from_openapi_data(**kw_args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 313, in _new_from_openapi_data
return cls._from_openapi_data(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model/log_attributes.py", line 141, in _from_openapi_data
self = super(LogAttributes, cls)._from_openapi_data(kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 583, in _from_openapi_data
setattr(self, var_name, var_value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 168, in setattr
self[attr] = value
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 509, in setitem
self.set_attribute(name, value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 137, in set_attribute
value = validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1622, in validate_and_convert_types
result[inner_key] = validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1573, in validate_and_convert_types
converted_instance = attempt_convert_item(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1444, in attempt_convert_item
return deserialize_primitive(input_value, valid_class, path_to_item)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1235, in deserialize_primitive
parsed_datetime = parse(data)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 1374, in parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 657, in parse
six.raise_from(ParserError(e.args[0] + ": %s", timestr), e)
TypeError: unsupported operand type(s) for +: 'int' and 'str'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 655, in parse
ret = self._build_naive(res, default)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 1238, in _build_naive
if cday > monthrange(cyear, cmonth)[1]:
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/calendar.py", line 124, in monthrange
raise IllegalMonthError(month)
calendar.IllegalMonthError: bad month number 0; must be 1-12
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/vechandr/git_repo/mdsqa_python3_automation/DSL_Automation/util/DatadogUtil.py", line 108, in
fetch_data_from_datadog(filter_query,filter_from,filter_to,expected_log_lines,unique_string)
File "/Users/vechandr/git_repo/mdsqa_python3_automation/DSL_Automation/util/DatadogUtil.py", line 53, in fetch_data_from_datadog
api_response = api_instance.list_logs_get(filter_query=filter_query_unique_string,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api/logs_api.py", line 307, in list_logs_get
return self._list_logs_get_endpoint.call_with_http_info(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api_client.py", line 844, in call_with_http_info
return self.api_client.call_api(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api_client.py", line 386, in call_api
return self.__call_api(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api_client.py", line 214, in __call_api
return_data = self.deserialize(response_data, response_type, _check_type)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/api_client.py", line 307, in deserialize
deserialized_data = validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1552, in validate_and_convert_types
converted_instance = attempt_convert_item(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1439, in attempt_convert_item
return deserialize_model(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1355, in deserialize_model
return model_class._new_from_openapi_data(**kw_args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 313, in _new_from_openapi_data
return cls._from_openapi_data(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model/logs_list_response.py", line 140, in _from_openapi_data
self = super(LogsListResponse, cls)._from_openapi_data(kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 583, in _from_openapi_data
setattr(self, var_name, var_value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 168, in setattr
self[attr] = value
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 509, in setitem
self.set_attribute(name, value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 137, in set_attribute
value = validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1602, in validate_and_convert_types
validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1552, in validate_and_convert_types
converted_instance = attempt_convert_item(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1439, in attempt_convert_item
return deserialize_model(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1355, in deserialize_model
return model_class._new_from_openapi_data(**kw_args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 313, in _new_from_openapi_data
return cls._from_openapi_data(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model/log.py", line 138, in _from_openapi_data
self = super(Log, cls)._from_openapi_data(kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 583, in _from_openapi_data
setattr(self, var_name, var_value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 168, in setattr
self[attr] = value
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 509, in setitem
self.set_attribute(name, value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 137, in set_attribute
value = validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1552, in validate_and_convert_types
converted_instance = attempt_convert_item(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1439, in attempt_convert_item
return deserialize_model(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1355, in deserialize_model
return model_class._new_from_openapi_data(**kw_args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 313, in _new_from_openapi_data
return cls._from_openapi_data(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 40, in wrapped_init
return fn(_self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model/log_attributes.py", line 141, in _from_openapi_data
self = super(LogAttributes, cls)._from_openapi_data(kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 583, in _from_openapi_data
setattr(self, var_name, var_value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 168, in setattr
self[attr] = value
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 509, in setitem
self.set_attribute(name, value)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 137, in set_attribute
value = validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1622, in validate_and_convert_types
result[inner_key] = validate_and_convert_types(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1573, in validate_and_convert_types
converted_instance = attempt_convert_item(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1444, in attempt_convert_item
return deserialize_primitive(input_value, valid_class, path_to_item)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/datadog_api_client/v2/model_utils.py", line 1235, in deserialize_primitive
parsed_datetime = parse(data)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 1374, in parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 657, in parse
six.raise_from(ParserError(e.args[0] + ": %s", timestr), e)
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Process finished with exit code 1