I want to make my own custom logging script on my Apache2 webserver. It should be executed on every server request (POST, GET, etc.) and then write some information into my database.
My problem is: I don't now how to trigger the execution.
I have searched (Google) for handlers in apache. "addHandler/setHandler" in apache2.conf. But these are just executed if a special file is requested.
And putting a script on each of my pages is no option too. Just because I can't put a script to a requested image.
Is there any option in config files to do something like:
onRequest var/www/html/customLog.php
I woud prefer .php
or .sh
. Thank you for giving a hint.
P.S. I'm running my server on linux.
The best way to do this is probably with CustomLog
, you can log everything described in custom log formats which should cover everything you might want to log, and you can pipe it to a program which could be PHP or a shell script as you like, for logging it to your database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With