Separate Log for Robot Page Access

Wohbah 2947779 at deadaddress.com
Sat Feb 6 13:32:23 MSK 2010


What about a variable?  There is no conditional in the location block.

        set $logchoice       /var/log/nginx/access.log;
        if ( $is_robot ~ T ) {
            set $logchoice   /var/log/nginx/robots.log;
        }

        location / {
          access_log  $logchoice;
          ...
          try_files /maintenance.html $uri.html @phptry ;
        }

<editorial>
Conditionals are fundamental.  Imagine a CPU without one.  Lack of
conditionals makes makes me ill.  One of the few things not to like about
nginx.  Mabye *location* is evil ... but not conditionals.  If nginx
conflicts with computer science, the flaw is not in compsci.

Now, avoiding "if" over labor effort, OK, that is a legitimate and good
reason!  In fact, it's a much better reason than denying fundamental
compsci.

But it means ugly software.  Nginx foists complexity onto user .conf files. 
Which, as you say, work inconsistently (more ugliness).

Still, thank you nginx for wonderful software.  It sometimes seems like a
baby with a rash, you just want it to heal so there's less diaper changing.
</editorial>

-- 
View this message in context: http://n2.nabble.com/Separate-Log-for-Robot-Page-Access-tp4524448p4524797.html
Sent from the nginx mailing list archive at Nabble.com.



More information about the nginx mailing list