"access_log" directive is not allowed here in... how to do this properly?

Francis Daly francis at daoine.org
Mon Mar 26 00:04:29 UTC 2012

On Sun, Mar 25, 2012 at 11:40:51PM +0000, Micheal Wolfskill wrote:

Hi there,

> >          access_log /root/$log.log;
> I did. No errors.. but its not writing any log file at all...

What does error_log say?

When I try to write to a new file in /root/ as a non-root nginx user,
I see something like

  open() "/root/default.log" failed (13: Permission denied)

> I think this defeats the purpose... because I only want to log for when the IP of the remote user matches any of those countries in the http {} section.

Probably something like

  map $geoip_country_code $mylogfile {
   default off;
   CN logs/access.log;
  access_log $mylogfile;

will work, then.

"log normally and post-process" is always another option, of course.

Francis Daly        francis at daoine.org

More information about the nginx mailing list