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

A Guide to OpenLiteSpeed Access and Error Logs

OpenLiteSpeed is a lightweight, open-source web server developed by LiteSpeed Technologies. It offers high performance and scalability, making it a popular choice for web applications and websites. Understanding how to configure and analyze OpenLiteSpeed’s logging system is essential for monitoring server performance, troubleshooting errors, and ensuring security.

OpenLiteSpeed maintains two main types of logs:

  1. Access Logs – Record details of incoming HTTP requests.
  2. Error Logs – Capture server-side errors, application issues, and warnings.

This guide will walk you through configuring, understanding, and using these logs to optimize your OpenLiteSpeed server.


Log & Configuration File Locations

Before diving into the details, it’s important to know where OpenLiteSpeed stores its logs and configuration files.

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/
Configuration Files/usr/local/lsws/conf/httpd_config.conf

Understanding OpenLiteSpeed Access Logs

What Are Access Logs?

Access logs capture details of all incoming HTTP requests processed by OpenLiteSpeed. These logs provide valuable insights into:

  • Visitor behavior and traffic sources
  • Frequently accessed pages and resources
  • Potential security threats, such as suspicious IP addresses or user agents

Configuring Access Logs

OpenLiteSpeed stores access logs in a central location by default. To enable or configure access logs, follow these steps:

  1. Access the Web Admin Console (usually accessible at http://<your-server-ip>:7080).
  2. Navigate to Server Configuration > Log.
  3. Configure the Access Log File path and rotation settings.

Sample Configuration:

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

Access Log Format

OpenLiteSpeed uses a format similar to the Apache 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 (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 browser information

Understanding OpenLiteSpeed Error Logs

What Are Error Logs?

Error logs capture server-side issues, such as misconfigurations, application errors, or problems with backend servers. These logs are crucial for identifying and troubleshooting server issues.

Configuring Error Logs

To configure error logs in OpenLiteSpeed:

  1. Open the Web Admin Console.
  2. Go to Server Configuration > Log.
  3. Set the Error Log File path and define the Log Level.

Sample Configuration:

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

Error Log Levels

OpenLiteSpeed supports multiple error log levels:

LevelDescription
ERRORCritical errors that need immediate attention
WARNWarnings that may indicate potential issues
NOTICESignificant but non-critical events
INFOGeneral informational messages
DEBUGDetailed debug information for troubleshooting

Sample Error Log Entry

An example of an entry in the OpenLiteSpeed 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 error indicates that the requested file /var/www/html/missingfile.php could not be found for the client IP 192.168.1.20.

Common Error Types

Some typical OpenLiteSpeed error messages include:

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

Configuring Logs for Virtual Hosts

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

  1. Navigate to Virtual Hosts in the Web Admin Console.
  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 allows you to maintain separate logs for each website, making it easier to troubleshoot and monitor individual sites.


Mastering OpenLiteSpeed logs is essential for maintaining server performance, optimizing security, and troubleshooting issues. By effectively configuring and analyzing access and error logs, you can gain valuable insights into your server’s operations and visitor behavior.

Use this guide to enhance your OpenLiteSpeed logging setup and improve your server management skills.

Updated on November 14, 2024
Was this article helpful?

Related Articles