Using Sawmill with WebSTAR V on MacOS X
This chapter was contributed by David Wrubel.
If you choose to run Sawmill in web server mode, run it as a separate webserver application with its own default port number 8988 on the same Mac as WebStar V.
Installation
Because of the way WebStar V is installed on MacOS X, the installation process of Sawmill is a little tricky. Part of the Sawmill (for WebStar V) installation process involves command line work in the OS X UNIX "Terminal". This work is done, using the root user privileges and should be done with extreme caution since the root user has write access to all files, including system files. Because of security reasons, 4D instructs WebStar users only to install the WebStar application when logged in MacOS X as the admin user. 4D advises WebStar V users to create a MacOS X user that does NOT have admin privileges. The user is normally called "webstar" and is used when WebStar V is running. This setup protects system files and the WebStar V application against some types of unauthorized intrusions. At the same time there is full access to all website files that users upload and download.The above imposes a problem for Sawmill, since Sawmill must be installed in MacOS X when the user is logged in as the admin user. When Sawmill is installed and you log out and then log in as the "WebStar" user, to run WebStar V, you will not have access to run Sawmill, since Sawmill only will run when logged in as the MacOS X admin user.
You have to change the ownership ID (or valid user name) of all Sawmill files from the admin user (typically the user that installed Mac OS X) to the "webstar" user, to be sure that Sawmill will run when logged in as the webstar user.
To do this, follow these steps (again: be careful, as you will be logged in as the root user as long as you are working in the Terminal):
- Webstar V and the "webstar" user must already be installed and configured.
- If you haven't done it already, please be logged in as the admin MacOS X user and install Sawmill. The default installation process will create a "Sawmill" folder in the MacOS X "Applications" folder. All Sawmill files and folders will be installed in the Sawmill folder. Do not start Sawmill after the installation.
- In the /Applications/Utilities folder, start the "Terminal" application.
At the command prompt key, type the following commands and use your admin user password when asked (in this example the admin user is "davidw"). Also be sure that the Terminal gives you the same returns. If you experience any differences, you can always type "Exit" to log out from the root user and thereby (hopefully) protect against damage:Commandline (bold type = your input) Comments Welcome to Darwin!
[localhost:~] davidw%When you start the Terminal and choose "New" in the "Shell" menu, you will see this in a new terminal window. [localhost:~] davidw% sudo su
Password:SUDO SU gives you root access. Type your admin password and hit the return key. [localhost:/Users/davidw] root# cd /applications/sawmill/ Navigates you to the "sawmill" folder. Note that the commandline says you are now "root#". [localhost:/applications/sawmill] root# ls -ls
total 9104
0 drwxrwxr-x 3 davidw admin 58 Apr 21 09:43 Extras
24 -rwxr-xr-x 1 davidw admin 9348 Apr 21 09:43 License.txt
8 -rwxrwxr-x 1 davidw admin 3113 Apr 21 09:43 ReadMe.txt
0 drwxrwxr-x 3 davidw admin 58 Apr 21 09:43 Sawmill.app
0 drwxrwxr-x 6 davidw admin 160 Apr 21 09:43 Startup
9072 -rwxr-xr-x 1 davidw admin 4641768 Apr 21 09:43 sawmill[localhost:/applications/sawmill] root# cd.. Navigate back to the Applications folder. [localhost:/applications] root# chown -R webstar sawmill Now be careful: key the command exactly as shown. This changes the ownership of all files in the sawmill folder including the sawmill folder itself. [localhost:/applications] root# cd sawmill Navigate into the sawmill folder [localhost:/applications/sawmill] root# ls -ls
total 9104
0 drwxrwxr-x 3 webstar admin 58 Apr 21 09:43 Extras
24 -rwxr-xr-x 1 webstar admin 9348 Apr 21 09:43 License.txt
8 -rwxrwxr-x 1 webstar admin 3113 Apr 21 09:43 ReadMe.txt
0 drwxrwxr-x 3 webstar admin 58 Apr 21 09:43 Sawmill.app
0 drwxrwxr-x 6 webstar admin 160 Apr 21 09:43 Startup
9072 -rwxr-xr-x 1 webstar admin 4641768 Apr 21 09:43 sawmillLet's list the files and folders in the sawmill folder to check that the ownerships have really been changed. Note that the owner is now "webstar" instead of "davidw". [localhost:/applications/sawmill] root# exit
exit
[localhost:~] davidw%Log out the root user by typing "exit" and hit the return key. Note that the admin user is returned.
- Be sure that you have typed "exit" and you are now the admin user. Close Terminal.
- Log out of Mac OS X (not shut down, only log out).
- Log in as the "webstar" user.
Log formats
When choosing log formats in WebStar V's "Admin Client" for a specific website, use "WebSTAR Log Format". Select all tokens and schedule WebStar V to archive log files once every day.In Sawmill's "Quick Start" you will be asked where the log files are located. WebStar V always creates log files for each defined website in the "logs" folder that is in the "WS_Admin" folder for each website.
Sawmill will automatically choose "WebSTAR Log format" and ONLY that format, if, and only if, the log is written correctly. If you experience that Sawmill gives you other logfile formats to choose from (including the correct format), then there is an error. Sawmill will only choose the correct log format when the first line in the log file, in the first log file that you want to be processed by Sawmill, has the correct log file header.
Solution
If you experience this error do the following:
1. Open the first log file that is supposed to be processed by Sawmill, in your favorite text editor on a MacOS X machine (this is important, since WebStar V log files now have file names that can be longer than 32 characters).
2. Find the first instance of the following text and move your cursor just before the text (with your date and time):
!!WebSTARSTARTUP 25/May/02 01:19:40
!!LOG_FORMAT BYTES_RECEIVED BYTES_SENT C-DNS.....
3. Mark all text from before the text and to the top of the file and delete the marked text. The above text should now be the very first text in the log. Save the file. Run "Quick Start" again.