Nginx ignores access_log directive when post_action specifie

Hi,

in the location below nginx writes a custom download log. Everything
works fine except when there is a post_action directive.

I seems that nginx skips the access_log directive but I don’t understand
why. Any help is greatly appreciated.

Here is the config:

location /download_intern/ {
internal;

if ($uri ~* ^/download_intern/([0-9]+)/) {
    set $transferID $1;
    set $server $arg_ip;
    set $url $arg_url;
    proxy_pass http://$server:80/$url;
    break;
}


log_format download '$remote_addr [$time_local]

$upstream_cache_status “$scheme://$host$request_uri” $status
[$transferID] $body_bytes_sent’;

access_log /opt/nginx/logs/server.download_log download;


# without this line the download log file is being written
post_action /done;

}

location /done {
internal;
# log the transfer on the main server
proxy_pass http://xxx.xxx.xxx.xxx:80/download_end/?tid=$transferID;
}

I am facing the same problem, is there any update on this issue ?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,92464,222201#msg-222201

Hello!

On Fri, Feb 10, 2012 at 01:29:26AM -0500, rishabh wrote:

I am facing the same problem, is there any update on this issue ?

Logging happens in a location where request completes, and with
post_action it’s the location where post_action processed.
So the problem looks like configuration one.

Maxim D.

Hello!

On Mon, Feb 20, 2012 at 07:28:52AM -0500, rishabh wrote:

 set_by_lua_file $logdata /var/www/log.lua;

In this case only access2.log(via post_action) is written and not the
default access.log(in http)

What would be an optimal solution.

If you want request to be logged into two logs, you have to define
two access_log directives where requests are logged, i.e.

location / {
    access_log /var/log/nginx/access.log;
    access_log /var/log/nginx/access2.log;
    ...
}

Maxim D.

Hi,

I am trying to log into two files. one default and one custom via
post_action.

http {
access_log /var/log/nginx/access.log;

server {
location @postactionlocation {
set_by_lua_file $logdata /var/www/log.lua;
access_log /var/log/nginx/access2.log ‘$logdata’;
return 444;
}

location / {
#someproxypass here
}

post_action @postactionlocation;
}

In this case only access2.log(via post_action) is written and not the
default access.log(in http)

What would be an optimal solution.

Thanks


Rishabh

Maxim D. Wrote:

post_action it’s the location where post_action
processed.
So the problem looks like configuration one.

Maxim D.


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,92464,222714#msg-222714

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs