Mercurial > hg > nginx-tests
changeset 771:abe795720deb
Tests: added test for syslog nohostname parameter.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 29 Oct 2015 12:53:56 +0300 |
parents | c35b071d4b47 |
children | cab9f60e561e |
files | syslog.t |
diffstat | 1 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/syslog.t Wed Oct 28 00:35:47 2015 +0300 +++ b/syslog.t Thu Oct 29 12:53:56 2015 +0300 @@ -26,7 +26,7 @@ my $t = Test::Nginx->new()->has(qw/http limit_req/); -$t->plan(58)->write_file_expand('nginx.conf', <<'EOF'); +$t->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -92,6 +92,10 @@ access_log syslog:server=127.0.0.1:8085 logf if=$arg_logme; } + location /nohostname { + access_log syslog:server=127.0.0.1:8080,nohostname; + } + location /debug { limit_req zone=one; error_log syslog:server=127.0.0.1:8080 debug; @@ -141,7 +145,7 @@ $t->waitforfile($t->testdir . '/s_http.log'); $t->waitforfile($t->testdir . '/s_if.log'); -$t->run(); +$t->try_run('no syslog nohostname')->plan(59); ############################################################################### @@ -209,6 +213,14 @@ like($t->read_file('s_if.log'), qr/good:404.*work:404/s, 'syslog if success'); unlike($t->read_file('s_if.log'), qr/(if:|empty:|zero:)404/, 'syslog if fail'); +like(get_syslog('/nohostname'), + qr/^<(\d{1,3})> # PRI + ([A-Z][a-z]{2})\s # mon + ([ \d]\d)\s(\d{2}):(\d{2}):(\d{2})\s # date + (\w{1,32}):\s # tag + (.*)/x, # MSG + 'nohostname'); + ############################################################################### sub syslog_lines {