Cast 'http_status' field into an integer

Co-Authored-By: Simon Pasquier <spasquier@mirantis.com>

Change-Id: I4d2b0e8bf413794b1d3b46d26aa5f599064e43ec
This commit is contained in:
Swann Croiset 2017-02-02 12:58:02 +01:00
parent ec842363e0
commit cceadc82c0
2 changed files with 5 additions and 5 deletions

View File

@ -121,7 +121,7 @@ http_request = http_method * sp * url * sp * l.P'HTTP/' * http_version
-- TODO(pasquier-s): build the LPEG grammar based on the log_format parameter
-- passed to eventlet.wsgi.server similar to what the build_rsyslog_grammar
-- function does for RSyslog.
local openstack_http_status = l.P"status: "^-1 * l.Cg(l.digit^3, "http_status")
local openstack_http_status = l.P"status: "^-1 * l.Cg(l.digit^3 / tonumber, "http_status")
local openstack_response_size = l.P"len: "^-1 * l.Cg(l.digit^1 / tonumber, "http_response_size")
local openstack_response_time = l.P"time: "^-1 * l.Cg(l.digit^1 * dot^0 * l.digit^0 / tonumber, "http_response_time")

View File

@ -87,12 +87,12 @@ TestPatterns = {}
assertEquals(patt.openstack_http:match(
'"OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731'),
{http_method = 'OPTIONS', http_url = '/', http_version = '1.0',
http_status = '200', http_response_size = 497,
http_status = 200, http_response_size = 497,
http_response_time = 0.0006731})
assertEquals(patt.openstack_http:match(
'foo "OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731 bar'),
{http_method = 'OPTIONS', http_url = '/', http_version = '1.0',
http_status = '200', http_response_size = 497,
http_status = 200, http_response_size = 497,
http_response_time = 0.0006731})
end
@ -100,12 +100,12 @@ TestPatterns = {}
assertEquals(patt.openstack_http:match(
'"OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731'),
{http_method = 'OPTIONS', http_url = '/', http_version = '1.0',
http_status = '200', http_response_size = 497,
http_status = 200, http_response_size = 497,
http_response_time = 0.0006731})
assertEquals(patt.openstack_http:match(
'foo "OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731 bar'),
{http_method = 'OPTIONS', http_url = '/', http_version = '1.0',
http_status = '200', http_response_size = 497,
http_status = 200, http_response_size = 497,
http_response_time = 0.0006731})
end