Log when file is requested from server
-
11-09-2019 - |
Question
I need a way to log an entry into a database, everytime a particular file is requested from the server. The file can be any type, even images or other media.
Is it also possible to log which IP address or hostname has requested that file?
Solution
What's the language? HTTP handler technology?
Example: java/servlet, ruby/rails, php/apache
...
In either case you can analyze the log file easily: HTTP log files contain ip, file name, timestamp.
It would be a ten lines in perl+DBI
to parse apache's config and count downloads into database. Stuck it int cron and be done.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow