1

I'm cleaning up an absolute mess of files - and have 75 gig of files which I'm not sure if they're being accessed through apache (and if they are, they're likely behind a maze of redirects) - I've duplicated the files, but with a new structure as the old structure was not coping with so many sub-folders.

What I would like to do, is log ONLY access to files beyond a certain path on the file-system /home/httpd/vhosts/sitename/httpdocs/hugedirectory/ so I can see if it's safe to delete them and recover some space.

3 Answers 3

1

Keep it simple. Use grep on your log file to filter out everything except the directory you're interested in.

grep 'GET /hugedirectory/' /var/log/apache2/sitename.access.log

Apache doesn't have a good way to separately log requests beyond the VirtualHost level. If you really want to have apache log directly to a separate log file, you could accomplish that with a custom logging script and pipe apache's access log to it. The CustomLog directive can specify a program which apache will start and write log data to that program's stdin, where you could then do some basic parsing and write the log files yourself.

Seriously though, just use grep.

0

Easiest solution is probably to enable logging in Apache, then filter the logs for the path. Not as elegant as only logging for some files, but probably simpler.

0

You should be able to parse-through your apache logs, looking for entries that match the base path (/var/www/html/hugedir may be /hugedir in the logs).

If after some amount of time (determinable by you, of course), you see no matches, it should be safe.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .