Forum Moderators: phranque
I'd appreciate someone helping me out here.
I need cookies to be logged in the Apache log files.
Our hosts have turned on mod_usertrack. I believe this simply issues a cookie to new visitors. I need more control than this.
How can I issue cookies and record them in the log file whenever I want with specific values?
Like when a user hits a specific page?
We use Perl.
Many thanks! - Chris
Welcome to WebmasterWorld!
We discussed this subject [webmasterworld.com] just last week. Give that thread a read, and post any specific questions back here.
Jim
I've read about the log.conf and the entry in there.
My understanding is that Apache can see cookies being issued and then record that in the log file.
One thing I don't understand is how does Apache know that a cookie has been issued?
Surely if I use JavaScript (client side processing) Apache would never know? Or would it?
So, having made those changes in the log.conf, if I used Perl to issue a cookie, it would appear in the log file? Or do I have to do something special?
Many thanks again!
A cookie is a small text file created by the browser, when instructed to do so by a header sent by the server, or by client-side code such as JavaScript.
Once a cookie is set on the client machine, it is sent by the client browser to the server for every request to any resource (page, image, stylesheet, etc.) that is within the 'domain' of that cookie. This 'domain' is specified by the server or by the client-side code that set the cookie. It's important to note that for security reasons, a browser will not send a cookie set by one domain to any other domain.
If you want to see cookies in action, use the Live HTTP Headers extension for Firefox, which will show the "Set-Cookie" headers sent by the server and the resulting "Cookie" header sent by the client back to the server with each subsequent request to that server.
Jim