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

Aline Manera alinefm at linux.vnet.ibm.com
Wed Jun 8 21:09:32 UTC 2016


Update the API.md to reflect that change. Also add a test to verify the 
API is working.

On 06/08/2016 04:27 PM, Lucio Correia wrote:
> 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




More information about the Kimchi-devel mailing list