An easy way to view maintenance logs using a browser
As part of our regular weekend maintenance for our Sybase database servers, we run many scripts, two of which are: update statistics and reorg/reindex. In the past, if we wanted to show the output (log) of a maintenance script to someone outside of our group, we had to attach the log to an email and email to the person with instructions to open it using "write" or Microsoft Word and not Notepad because of the way unix/linux and windows handle new lines. I wanted to get away from this painful ordeal by having the webserver find the logs and display them. Now we just have to give the url to the person once. Cool
As we use Apache with mod_perl and Mason quite heavily, I decided the easiest way to do this is to create a component to obtain the list of the log files I'm interested in. When I click on one of the files, instead of accessing the file semi-directly using a symbolic link to the file, a dhandle is called instead. The dhandle catches the reorg/SISDBA1.out request, goes and reads the real file and spits it out. If the file is an archived log (compressed), then we uncompress the file as we read it.
Adding a new series of log files are easy because the criteria we search for is a prefix in the filename. Change the prefix in the index.html file, then the new log files are now viewable. Of course, you will want to either modify the index.html file to handle multiple types of log files or just create another directory (i.e. dbccs) and copy the index.html & dhandler into it.
Adding a CSS template to this would be a simple matter. In any case, enjoy!
Source code
As we use Apache with mod_perl and Mason quite heavily, I decided the easiest way to do this is to create a component to obtain the list of the log files I'm interested in. When I click on one of the files, instead of accessing the file semi-directly using a symbolic link to the file, a dhandle is called instead. The dhandle catches the reorg/SISDBA1.out request, goes and reads the real file and spits it out. If the file is an archived log (compressed), then we uncompress the file as we read it.
Adding a new series of log files are easy because the criteria we search for is a prefix in the filename. Change the prefix in the index.html file, then the new log files are now viewable. Of course, you will want to either modify the index.html file to handle multiple types of log files or just create another directory (i.e. dbccs) and copy the index.html & dhandler into it.
Adding a CSS template to this would be a simple matter. In any case, enjoy!
Source code
