[Kimchi-devel] [PATCH] [Wok 6/6] Add status code to request log message

Lucio Correia luciojhc at linux.vnet.ibm.com
Wed Jun 8 19:27:15 UTC 2016


Also, remove download field from filtering options.

Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
---
 src/wok/reqlogger.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/wok/reqlogger.py b/src/wok/reqlogger.py
index 6f32c44..8fadbcf 100644
--- a/src/wok/reqlogger.py
+++ b/src/wok/reqlogger.py
@@ -34,16 +34,17 @@ from wok.utils import ascii_dict, remove_old_files
 
 
 # Log search setup
-FILTER_FIELDS = ['app', 'date', 'download', 'ip', 'req', 'user', 'time']
+FILTER_FIELDS = ['app', 'date', 'ip', 'req', 'status' 'user', 'time']
 LOG_DOWNLOAD_URI = "/data/logs/%s"
 LOG_DOWNLOAD_TIMEOUT = 6
-LOG_FORMAT = "[%(date)s %(time)s %(zone)s] %(req)-6s %(app)-11s %(ip)-15s " \
-             "%(user)s: %(message)s\n"
+LOG_FORMAT = "[%(date)s %(time)s %(zone)s] %(req)-6s %(status)s %(app)-11s " \
+             "%(ip)-15s %(user)s: %(message)s\n"
 RECORD_TEMPLATE_DICT = {
     'date': '',
     'time': '',
     'zone': '',
     'req': '',
+    'status': '',
     'app': '',
     'ip': '',
     'user': '',
@@ -157,6 +158,7 @@ class RequestParser(object):
         uri = None
         results = []
         records = self.getRecords()
+        download = filter_params.pop('download', False)
 
         # fail for unrecognized filter options
         for key in filter_params.keys():
@@ -164,8 +166,6 @@ class RequestParser(object):
                 filters = ", ".join(FILTER_FIELDS)
                 raise InvalidParameter("WOKLOG0001E", {"filters": filters})
 
-        download = filter_params.pop('download', False)
-
         # filter records according to parameters
         for record in records:
             if all(key in record and record[key] == val
-- 
1.9.1




More information about the Kimchi-devel mailing list