Right now there's no log entry for successful purges that return a 200 response and an error level entry for any non-200 response.

nginx returns a 404 if the page isn't in the cache. It's not really an error if the page doesn't exist in the cache at the time of the purge.

It might be more useful to have a normal log entry that displays both successful purges and unsuccessful purges.

Comments

SqyD’s picture

Agreed, the error logging needs some work. Right now the varnish config I use is very simple. A 404 should be implementable on Varnish too. I'll need to check what usefull error codes squid can return...

brianmercer’s picture

I'm trying to come up with an nginx config that will return a 200 on a miss.

EDIT: OK, this seems to work alright:

## Cache purging
server {
  listen 127.0.0.1:8888 default_server;

  access_log /var/log/nginx/caching.access.log;
  keepalive_timeout 0 0;
  error_page 405 $request_uri;

  location / {
    fastcgi_cache_purge mycache $host$request_uri;
    return 200;
  }
}

And with all 200 responses, the log looks good. Thanks.

SqyD’s picture

Title: watchdog entries could include successful purges and should not log an error on cache miss » Error handling and wathdog improvements
Component: User interface » Code
Category: bug » feature

Your solution sure fixes it for now but having this hit/miss information could be very useful when debugging. To minimize resources I ignore the output of the curl request, just error code handling.

I propose to keep the nginx specific stuff in the other issue and keep this one as a feature request for better error handling.

SqyD’s picture

Title: Error handling and wathdog improvements » Error handling and watchdog improvements
SqyD’s picture

Status: Active » Closed (fixed)

I've restructured the error handling code in current dev. This will go into a 1.1 release. It now shows detailed results, even if all seems fine. It also picks up on 404 (not found) errors correctly.