Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache 2.2 logs to include # in web page access

Status
Not open for further replies.

delar

Programmer
Mar 22, 2012
2
US
I can not seem to find an answer to this through Google, so I'm hoping I can get some help here. I have a requirement to track # (pound mark) web page access through the Apache 2.2 logs.

An example is:


It has been requested that I compile a report using the Apache Logs to identify web page access statistics. The logs currently record the hit access to test.cfm but truncates the #SomeID information and I've been unable to find an Apache log command to include it.

Anyone have an idea on how to include the #SomeID information in the Apache Logs?
 
Welcome to tek-tips!

I am not so sure that you can track these in the access log. The reason being is that I don't think that they are actually part of get request that is passed to the server. See the following page which describes how these are on-page bookmarks: In other words, they may actually only be interpolated at the client end, not the server end.

In order to confirm or show proof positive of this, you could run an experiment with a tool like Wireshark and show the actual GET request and verify that the string after the # mark is not transmitted as part of the request. In any case, it does not appear to be logged.
 
Hi

Noway2, for you would be enough to just sign your previous post without further words. Your handle already contains the answer : no way. ;-)

The browsers not send the hash part of the URL to the server.

For example when visiting this page, my request to [navy][ignore][/ignore][/navy] was sent as :
Code:
[b]GET[/b] [navy]/viewthread.cfm?qid=1678571[/navy] HTTP/1.1
[b]Host:[/b] [navy]tek-tips.com[/navy]
[b]User-Agent:[/b] Mozilla/5.0 [gray]...shortened this one...[/gray]
[b]Accept-Language:[/b] en-us,en;q=0.5
[b]Accept-Encoding:[/b] gzip, deflate
[b]DNT:[/b] 1
[b]Connection:[/b] keep-alive
[b]Cookie:[/b] __utma=[gray]...shortened this one...[/gray]
[b]Pragma:[/b] no-cache
[b]Cache-Control:[/b] no-cache
Then when I clicked the Reply To This Thread link to jump to the reply [tt]form[/tt], or in other words visited [navy][ignore][/ignore][/navy], absolutely no request was sent to the server.

That would mean, your only possibility is to write a JavaScript to send the hash in query string through AJAX, so the server can collect them.

Feherke.
 
The browsers not send the hash part of the URL to the server.

That's about the size of it.

The '#' is a document fragment marker so is NOT part of the HTTP request and the server never receives that part of the URI.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top