I am trying to find out how many times a specific web file has been accessed. I have root access to the server, but not sure where to look. The only place I have looked in is /home/FTPUSER/access-logs which is a sym link to /usr/local/apache/domlogs/perrysre and that access log only has 1 day of data in it.
Any help would be greatly appreciated.
If your access log contains only a day's worth of data it is presumably being rotated each day. You'll need to work out how this is configured. If you're using Linux it might be with
logrotate
-- look in/etc/logrotate.d/
or/etc/logrotate.conf
if they exist. On FreeBSD log rotation is configured in/etc/newsyslog.conf
.Apache might also be doing it via rotatelogs. If so, this'll be set up in a
CustomLog
line in the server configuration (httpd.conf
), which could be in/etc/httpd
or, more likely given your log location,/usr/local/apache/conf
.If none of this works ask the person who configured it!
I think, since from your question I can't argue the system settings you are operating in, a universal way to find files used by a process can do the trick.
Try using lsof -p
<PID_OF_APACHE_DAEMON>
.You can retrieve the PID in a number of ways, one can be looking at netstat -tlnop output, another is using lsof -i, and so on.
This is a POC that can work:
Here I have assumed your apache daemon is listening on the standard tcp port 80 of course.
all Apache logs are usually stored in :
/var/log/apache(2)/access.log
/var/log/apache(2)/error.log
/var/log/apache(2)/customs .log
a nice commande I like in order to count something :
then you will have a number. Let's suppose you have a FTP logs, and every time john connects, there is a line 'John opened a session'. So you will do :
will give you how many times did John open a session. If you want period of times,etc you could also do it