Options for selective logging

Igor A. Ippolitov iippolitov at nginx.com
Wed Sep 20 10:13:25 UTC 2017


Let me reply with a link:
http://nginx.org/en/docs/http/ngx_http_split_clients_module.html
You can either use split_clients to change upstream or to trigger 
logging with 'if' option of 'access_log'

On 19.09.2017 21:17, mblancett wrote:
> I am looking for ways to target every Nth request into a very busy proxy
> within an nginx configuration. This particular proxy is extremely busy and
> receives POSTs to a single URI, and taking an approach like sharding by IP
> would not be the kind of traffic sample we’re after.
>
> The long term goal here is to replay some small amount (like 0.05%) of
> requests into a separate test environment. Currently I’m logging the entire
> request to ramdisk and using an every minute logrotation script in python to
> get the small proportion of requests I need, then using python ‘requests’ to
> replay them against the separate environment. This works, but the proxy
> underperforms its neighbors in the dns pool noticeably, and the RAM
> requirement is just too high for this to be sustainable long-term.
>
> I’d much prefer to find some way to have nginx only log the data that is
> necessary. I’ve seen that there is an http_mirror command that came out very
> recently which is nearly perfect for my needs, but that leaves the problem
> of only mirroring a percentage of the traffic.
>
> Thanks for your suggestions.
>
> Posted at Nginx Forum: https://forum.nginx.org/read.php?2,276452,276452#msg-276452
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx




More information about the nginx mailing list