1. Home
  2. Logs
  3. Web Servers
  4. A Guide to LiteSpeed Access and Error Logs

A Guide to LiteSpeed Access and Error Logs

LiteSpeed Web Server (LSWS) is a high-performance web server that is widely used as a drop-in replacement for Apache. Known for its speed, scalability, and efficient resource usage, LiteSpeed is commonly deployed in shared hosting environments and high-traffic websites. Understanding how to manage LiteSpeed’s logging system is essential for monitoring traffic, optimizing performance, and diagnosing server issues.

LiteSpeed maintains two primary types of logs:

  1. Access Logs – Track incoming HTTP requests to your server.
  2. Error Logs – Record server-side errors, application issues, and performance warnings.

This guide will cover how to configure, analyze, and use both types of logs in LiteSpeed.


Log & Configuration File Locations

Before diving into the specifics, it’s helpful to know where LiteSpeed stores its logs and configurations.

DescriptionLocation
Access Logs/usr/local/lsws/logs/access.log
Error Logs/usr/local/lsws/logs/error.log
Virtual Hosts Logs/usr/local/lsws/Example/logs/
LiteSpeed Configuration/usr/local/lsws/conf/httpd_config.xml

Understanding LiteSpeed Access Logs

What Are Access Logs?

Access logs capture details of all incoming HTTP requests to your LiteSpeed server. They provide insights into:

  • Visitor behavior and traffic sources
  • Popular pages and requested resources
  • Potential security threats (e.g., suspicious user agents or IPs)

Configuring Access Logs

LiteSpeed stores access logs in a central location by default. To enable or configure access logs, you can modify the settings in the LiteSpeed Web Admin Console:

  1. Log into the LiteSpeed Web Admin Console (usually accessible via https://<your-server-ip>:7080).
  2. Navigate to Server Configuration > Log.
  3. Configure the access log file path and rotation settings.

Sample Configuration in LiteSpeed Web Admin:

Access Log: /usr/local/lsws/logs/access.log
Log Format: %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"

Access Log Format

LiteSpeed uses a format similar to Apache’s combined log format:

%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"

Sample Access Log Entry:

192.168.1.20 - - [14/Nov/2024:10:15:23 +0000] "GET /index.html HTTP/1.1" 200 4523 "https://example.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
FieldDescription
%hClient IP address
%lIdentd logname (not often used, usually ‘-‘)
%uAuthenticated user (if any)
%tTimestamp of the request
"%r"HTTP method, path, and protocol
%>sHTTP status code
%bResponse size in bytes
"%{Referer}i"Referrer URL
"%{User-Agent}i"Client’s user agent

Understanding LiteSpeed Error Logs

What Are Error Logs?

Error logs capture any issues that occur while LiteSpeed processes requests, such as configuration problems, application errors, and server failures. These logs are essential for troubleshooting and maintaining server stability.

Configuring Error Logs

To configure error logs, you can adjust the settings in the LiteSpeed Web Admin Console:

  1. Navigate to Server Configuration > Log.
  2. Set the Error Log file path and define the Log Level.

Example Configuration:

Error Log: /usr/local/lsws/logs/error.log
Log Level: WARN

Error Log Levels

LiteSpeed supports several levels of error logging:

LevelDescription
ERRORCritical errors that need immediate attention
WARNWarnings that might indicate potential problems
NOTICESignificant events that are not errors
INFOGeneral information about server operations
DEBUGDetailed debugging information

Sample Error Log Entry

An example of an entry in the LiteSpeed error log:

2024-11-14 10:16:45.123 [ERROR] [192.168.1.20:54321] File not found: /var/www/html/missingfile.php

Explanation:

  • The log entry indicates a missing file error for a request made from the client IP 192.168.1.20.

Common Error Types

Some typical LiteSpeed error log messages include:

Error MessageDescription
File not foundThe requested file or resource could not be found
Permission deniedThe server does not have the necessary permissions to access the resource
503 Service UnavailableThe server is temporarily overloaded or down
Connection reset by peerThe client closed the connection before the server responded

Configuring Logs for Virtual Hosts

LiteSpeed allows you to configure separate logs for different virtual hosts. This is useful if you are hosting multiple websites on the same server:

  1. In the LiteSpeed Web Admin Console, go to Virtual Hosts.
  2. Select the virtual host you want to configure.
  3. Under the Log section, set the paths for both Access Log and Error Log.

Example Configuration for a Virtual Host:

Access Log: /usr/local/lsws/Example/logs/example.access.log
Error Log: /usr/local/lsws/Example/logs/example.error.log
Log Level: WARN

This configuration will store logs for a specific website in separate files, making it easier to analyze and troubleshoot individual sites.


Mastering LiteSpeed logs is crucial for maintaining a high-performing, stable, and secure web environment. By effectively configuring and analyzing access and error logs, you can gain insights into visitor behavior, optimize server performance, and quickly diagnose issues.

Use this guide to optimize your LiteSpeed logging setup and enhance your server management capabilities.

Updated on November 14, 2024
Was this article helpful?

Related Articles