nginx ignores access_log directive when post_action specifie
Maxim Dounin
mdounin at mdounin.ru
Mon Feb 20 15:18:32 UTC 2012
Hello!
On Mon, Feb 20, 2012 at 07:28:52AM -0500, rishabh wrote:
> 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.
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 Dounin
More information about the nginx
mailing list