Applies to: SmarterStats 3.x and higher
A load-balanced (clustered) Web site is one in which a single Web site is distributed across more than one server. Another common term for this type of structure is "Web farm."
There are two common methods of load balancing: session-based and hit-based. Each method requires following different steps to ensure SmarterStats analyzes the data correctly.
Session-Based Load Balancing
Session based load balancers attempt to keep all traffic for a specific visitor on the same server. This is known as "persistence" or "stickiness."
The following steps explain how to copy and rename logs from per-session load-balanced servers to a single server so that SmarterStats can import them. You can alter or adjust these steps to accommodate particular requirements as needed.
On each of the load-balanced servers, do the following:
- Make a new directory on the C: drive called C:\SmarterStatsLogFileMerge
- Create a new batch file using Notepad called DoLogFileMerge.bat that contains the code below (all one line).
XCOPY "C:\WINDOWS\system32\Logfiles\W3SVC1\*.LOG" " file://smarterstats/Logs/Site1/*.LOG_A" /D /Y
IMPORTANT NOTE 1: This code assumes that your original logs on this server are contained at C:\WINDOWS\system32\Logfiles\W3SVC1, that SmarterStats is running on a remote server called file://smarterstats/, and that the share \Logs\Site1 is where the logs should be copied to on that server.
IMPORTANT NOTE 2: The file mask *.LOG_A below should be different for each server. For example, other servers may be *.LOG_B, *.LOG_C, etc.
- Save the file and exit Notepad.
-
Go to Start -> Programs -> Accessories -> System Tools -> Scheduled Tasks.
-
Add a new scheduled task.
-
Click Browse and click the newly created batch file.
-
Choose the frequency of the copy you want. Most will want to set this to Daily, starting around 1:00 AM.
-
Enter a username and password for a user that has permission to copy to the share you made.
-
Save the scheduled task.
- Test the scheduled task by right-clicking it and choosing Run. After it runs, ensure that the logs were successfully copied.
Hit-Based Load Balancing
A hit-based load balancer distributes all requests evenly across its Web sites. For example, a visitor requesting a Web page may receive the HTML from one server and images from one or more other servers. This is the best performing style of load-balancing, but it results in stats that are difficult to track because of time differences and delays in logging the data.
If your Web site is load balanced and separate log storage locations appear on different servers, you will need to manually combine the logs so that SmarterStats can treat them as one Web site. To do this, you will need a third-party log combining tool, of which many are available and can be found by searching Google.
A decent one for IIS W3C log files is Tony Edgecombe's LogC, mirrored at http://www.smartertools.com/downloads/utilities/logc.zip. When using it, export the files as .log files, not .gz files, which are not supported.
Using the third-party combining tool, combine the log files from your various servers into one main directory and refer to that directory when configuring the Web site in SmarterStats.