By jc174 on
Drupal's "Recent Log Entries" page shows "Page Not Found" errors, but these don't tell me what page the users were on when they clicked on the link that got them to the "Page Not Found" error. This makes no sense to me. Wouldn't that be the most important piece of information we would want to know?
More importantly, is there another way I can get that information?
Thanks in advance for any help.
Comments
To clarify, it seems there
To clarify, it seems there are too many "Page Not Found" errors on my site for them to have been typed in directly. Is it possible that it's not always picking up the referrer? Is there another possibility?
Yes - exactly my
Yes - exactly my question.
I'm working on a large site, and the logs show lots of "Page not found" errors. In all cases I've seen, there is no information for "Referrer".
Is there a setting or something that we're missing? Otherwise, why wouldn't the logs be showing a Referrer for the page not found messages (and how can that be fixed)?
Thanks,
Jim
page not found
i'm using drupal 6.13 and i have a referrer in the log, but that doesn't help me anyway. the referrer is watchdog or ...reports/dblog. so? what is the "Location" in the logs. is that the "page" not found?
Re: no referrer info for "page not found" logs entries?
Exactly, this is pointless. I have the Scanner module installed which helps, because I then copy and paste each page not found into the search and it helps me to find the bad link (if any, because it could be the user typing in the wrong URL, or it could be from another website or static page).
Putting a referring page would be VERY helpful since this method is rather tedious. However I rely on Google Webmaster Tools or whatever it is called as well to help.
Drupal 5.X needs this. It seems so simple that I may just hack core to make it happen, since no one else is doing anything about it. OK I just looked at the db, and indeed the watchdog table keeps track of the referrer if there is one.. (NOTE: they spelt 'referrer' incorrectly as 'referer' in the db).
So it seems like a quick correction or patch to /modules/watchdog/watchdog.php will display the referrer.
I just tested and it works for me, but there may be more to correct. I double the amount of characters to show for the referring link, as seeing the entire link is necessary. Increase it more if you like (it is the '112' in the last line).
Drupal 5.15, possibly 5.x patch (/modules/watchdog/watchdog.php):
I did notice after this patch lots of referrers were still blank. I realized that the same 'page not found' could have blank referrers as well as non-blanks. The query was just fetching the referrer for one of those hits and more often than not it was a blank.
So this may not be the correct way, and I bet you could write it into the LINE 171 query instead, but I did a check to see if the referer was blank, and if so it would look in the watchdog table for a non-blank referer for that exact page not found. This made the loading time a lot slower.
I also noticed this patch will also show the referrer on 'access denied' and 'top search phrases'. If you don't want the patch to slow down those pages as well, you will have to do some coding yourself and put some conditional statements for if ($type == "page not found") to execute the patch. I didn't, I just left it for those pages because it was easier. Let me know how to improve the speed of this patch as I am not sure if the method I choose for the queries or how I did it is that amazing.
Anyhow here is the second patch if you want it added: