mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 02:47:36 -02:30
be forgiving in log api log message fields list
This commit is contained in:
@@ -102,13 +102,16 @@ class LogstashFormatter(LogstashFormatterVersion1):
|
|||||||
request = raw_data['python_objects']['request']
|
request = raw_data['python_objects']['request']
|
||||||
response = raw_data['python_objects']['response']
|
response = raw_data['python_objects']['response']
|
||||||
|
|
||||||
|
# Note: All of the below keys may not be in the response "dict"
|
||||||
|
# For example, X-API-Query-Time and X-API-Query-Count will only
|
||||||
|
# exist if SQL_DEBUG is turned on in settings.
|
||||||
headers = [
|
headers = [
|
||||||
(float, 'X-API-Time'), # may end with an 's' "0.33s"
|
(float, 'X-API-Time'), # may end with an 's' "0.33s"
|
||||||
(int, 'X-API-Query-Count'),
|
(int, 'X-API-Query-Count'),
|
||||||
(float, 'X-API-Query-Time'), # may also end with an 's'
|
(float, 'X-API-Query-Time'), # may also end with an 's'
|
||||||
(str, 'X-API-Node'),
|
(str, 'X-API-Node'),
|
||||||
]
|
]
|
||||||
data_for_log['x_api'] = {k: convert_to_type(t, response[k]) for (t, k) in headers}
|
data_for_log['x_api'] = {k: convert_to_type(t, response[k]) for (t, k) in headers if k in response}
|
||||||
|
|
||||||
data_for_log['request'] = {
|
data_for_log['request'] = {
|
||||||
'method': request.method,
|
'method': request.method,
|
||||||
|
|||||||
Reference in New Issue
Block a user