Forum OpenACS Development: Capturing 404's

Collapse
Posted by Lars Pind on
Has anyone figured out how to capture 404-not-founds (or other error messages, for that matter) and somehow record it (database table?) so we can show a nice stat page saying these URls were requested but not found, here's the referrer source, etc., so web masters can fix their sites?

I was thinking redirecting the NotFoundResponse to some Tcl code, which can return the 404 page, and then log the incident in a DB table.

But maybe a much simpler approach would be to have some code that scans the access log for 404's and shows that.

An RSS feed for these events would be nice, obviously.

Thoughts?

/Lars

Collapse
3: Re: Capturing 404's (response to 1)
Posted by Malte Sussdorff on
Why not use analog or webalizer and make the reports accessible through AOLserver? Or do you plan more fancy stuff with the data collected? In that case I'd look into the code of analog and store the results in Postgres and run your own scripts on top of the results.
Collapse
2: Re: Capturing 404's (response to 1)
Posted by Tom Jackson on

Capturing 404's is a breaze nowadays, ever since this proxy request mechanism was added to AOLserver. Here's what to do:

  • Add the following configuration parameter to your config file:
    ns_section ns/server/${server}/redirects
    ns_param   404                "global/file-not-found.tcl"
    ns_param   500                "global/server-error.tcl"
    
  • Create the file-not-found.tcl page to do whatever you want.

I'm doing the same thing now to catch errors, with server-error.tcl. I'm not sure why the ns_section is called 'redirects'.

Collapse
4: Re: Capturing 404's (response to 1)
Posted by Andrew Grumet on
I'd stick with the access logs and avoid per-incident db inserts.  Bogus 404's tend to proliferate during virus attacks, so you'd be chipping away at the virtue of not running IIS.
Collapse
5: Re: Capturing 404's (response to 1)
Posted by Dave Bauer on
I agree with Andrew. Extracting this data from the logs is the best way to go.
Collapse
6: Re: Capturing 404's (response to 1)
Posted by Bruce Spear on
Lars, isn't this what Nima has done for Mannheim?  I remember seeing a fine page whereby the error details were inserted automatically into a form that the hapless user could add to, explaining what he had done and demonstrating that he was probably not alone, that someone wanted to feel his pain, and that chances are good Progress would be made to avoid this trouble in the future, you know, no more SECURITY VIOLATION screaming at you.
Collapse
7: Re: Capturing 404's (response to 1)
Posted by Nima Mazloumi on
Offering a form to a bug-tracker instance is easy but the idea was to integrate so far that the form is filled with all info required (package, stack trace, links ...) and the user only needs to add a short note. Also the idea was to integrate with a help sytem that offers more info depending on user-role and package to avoid duplicate tickets in the bug-tracker.

Bruce: at present this is work in progress. I have all the parts but haven't had time to bring all together.