Most of the logging options for LiteSpeed web server are very basic and general however I wanted to detail them to help others make educated decisions when it comes to the logging configuration. There is one option I use outside of the normal log configurations which is configured in a tab other than the log tab under server configuration. Below I will explain all of the configuration options and provide examples of what I recommend for LiteSpeed.
The very first thing I do when configuring a new server is to modify the “Disable Initial Log Rotation” option from “Not Set” to Yes. The purpose of this option is to make the lsws log file directory a bit more manageable. The Disable Initial Log Rotation option will stop the error.log file from being rotated every time the server is restarted. If you are on a development server this might happen numerous times a day thus creating a mess in your log directory. Instead I only rotate the error.log file based on size as described in detail below.
To Modify Disable Initial Log Rotation:
- Open LiteSpeed Web Admin Console:Login to your LiteSpeed web admin console which is located on port 7080 by default so it might be something like http://192.168.1.244:7080
- Open LiteSpeed Server Configuration: Now click on Configuration in the top navigation menu and select Server from the drop down.
- Edit LiteSpeed General Settings: Click the Edit link on the top right side of the General Settings window of the General tab. This will allow you to edit any of the options in this section. Select the radial button next to Yes on the Disable Initial Log Rotation configuration line. Now click the Save link at the top right area of the General Settings window.
- Grancefully Restart LiteSpeed:Now you need to gracefully restart LiteSpeed by clicking on Actions in the top navigation menu and selecting Graceful Restart from the drop down. A window will pop up asking you to confirm you want to restart LiteSpeed as shown below so click the OK button to restart the web server.
Now that the error log is set to only rotate on size there will be less files in the LiteSpeed web server logging directory. Below is an image of the rest of the LiteSpeed web server logging options. You get to the below page by logging into the LiteSpeed web admin console, clicking Configuration in the top navigation menu, selecting Server from the drop down, and then clicking on the Log tab.
Here is a basic explanation of each of the options available on this page. There are two sections of options which are Server Log and Access Log. The server log is for LiteSpeed web server messages which could be status messages or error messages. The access log is for traffic to the web sites. Typically access logs are configured on a per virtual host basis and the server log (error log) is not configured on a virtual host basis.
- Server Log
- File Name: The name of the log file. Default: $SERVER_ROOT/logs/error.log
- Log Level: The type of messages that will be logged. DEBUG will log the most messages. Options include DEBUG, INFO, NOTICE, WARNING, ERROR Default: DEBUG
- Deug Level: The amount of messages that will be logged. NONE will not log any messages. Options include NONE, LOW, MEDIUM, HIGH. Default: NONE
- Rolling Size (bytes): The size of the file before it is rotated. Default: 10M
- Enable stderr Log: Specifies whether to write to log when receiving stderr output from any process started by the server. Default: Yes
- File Name: $SERVER_ROOT/logs/access.log
- Pipped Logger:Specifies the external application that will receive the access log data sent by LiteSpeed through a pipe on its STDIN stream (file handle 0). When specified, access log will be sent only to the logger application but not the access log file specified in previous entry. Default: Empty
- Log Format: Specified the format to be used in the log file. This is compatible with Apache’s log format as described here. Default: Empty
- Log Headers:Specifies what HTTP Headers to log. Options include Referrer, UserAgent, Host, None. Default: Nothing checked.
- Rolling Size (bytes): Specifies the size of the log file when it will be rotated. Default: 10M
- Keep Days:Specifies the number of days to keep rotated log files. You can set this to 0 if you do not want access logs to be deleted by LiteSpeed. Default: 30
- Compress Archive: To save on space set this to yes to compress rotated log files. Default: No
This is a basic overview of what options are available for LiteSpeed web server logging options. It is best to minimize the amount of logging because the more items that have to be written to disk the more of a performance hit the web server will take. Don’t be afraid to crank up the logging level though during troubleshooting to assist in resolving your issue.