how to separate robot access log and human access log

Francis Daly francis at daoine.org
Thu Apr 30 17:44:53 UTC 2015


On Mon, Apr 27, 2015 at 07:45:17PM -0400, meteor8488 wrote:

Hi there,

> I'm trying to separate the robot access log and human access log, so I'm
> using below configuration:

"if=" on the access_log line is what you want.

> access_log /web/log/location_access.log  main;

"No 'if=' there" means "log all requests to this file". (Unless overridden
later.)

> access_log /web/log/spider_access.log main if=$spiderbot;
> access_log /web/log/rssbot_access.log main if=$rssbot;
> 
> But it seems that nginx still writes some robot logs in to both
> location_access.log and spider_access.log.

Do you mean "some" or "all"?

> How can I separate the logs for the robot?

If you want /web/log/location_access.log to only log some requests,
add an "if=" to mark the requests that you want logged.

> And another questions is that some robot logs are not written to
> spider_access.log but exist in location_access.log. It seems that my map is
> not working. Is anything wrong when I define "map"?

Example?

Anything written to /web/log/rssbot_access.log would match that
description, but I guess that's not what you mean.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list