Skip to content

Logs

OpenLiteSpeed writes two types of logs: error logs and access logs. Both can be configured at the server level and overridden per virtual host.

LogDefault Path
Server error log/usr/local/lsws/logs/error.log
Server access log/usr/local/lsws/logs/access.log
Stderr log/usr/local/lsws/logs/stderr.log
Admin error log/usr/local/lsws/admin/logs/error.log

In /usr/local/lsws/conf/httpd_config.conf:

errorlog /usr/local/lsws/logs/error.log {
logLevel WARN
debugLevel 0
rollingSize 10M
enableStderrLog 1
}

In the virtual host config (vhconf.conf):

errorlog /usr/local/lsws/logs/example.com-error.log {
useServer 0
logLevel WARN
rollingSize 10M
}

Set useServer to 0 to use a vhost-specific log file, or 1 to write to the server-level error log.

LevelDescription
ERRORErrors only. Minimal output.
WARNWarnings and errors. Recommended for production.
NOTICENormal but significant events.
INFOInformational messages.
DEBUGDebug output. Generates large volumes of log data.

Set the level in the config:

logLevel WARN

For temporary debugging, set debugLevel to a non-zero value (0-10). Higher values produce more output:

debugLevel 5

Reset debugLevel to 0 after troubleshooting.

accesslog /usr/local/lsws/logs/access.log {
rollingSize 10M
keepDays 30
compressArchive 1
logReferer 1
logUserAgent 1
}
accesslog /usr/local/lsws/logs/example.com-access.log {
useServer 0
logFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
rollingSize 10M
keepDays 30
compressArchive 1
}

OLS uses Apache-compatible log format strings:

VariableDescription
%hRemote host (IP address)
%lRemote logname (usually -)
%uAuthenticated user
%tTimestamp
%rRequest line
%>sFinal HTTP status code
%bResponse size in bytes
%{Referer}iReferer header
%{User-Agent}iUser-Agent header
%DRequest processing time in microseconds
%TRequest processing time in seconds

OLS has built-in log rotation controlled by these parameters:

ParameterDescriptionDefault
rollingSizeRotate when the log file reaches this size10M
keepDaysDelete rotated logs older than this many days30
compressArchiveCompress rotated log files (1 = on)0

Rotated files are named with a timestamp suffix, for example error.log.2025_01_15.

If you prefer external rotation with logrotate, disable built-in rotation by setting rollingSize to 0:

/usr/local/lsws/logs/*.log {
daily
rotate 14
compress
missingok
notifempty
postrotate
kill -USR1 $(cat /tmp/lshttpd/lshttpd.pid)
endscript
}
Terminal window
# Tail the error log
tail -f /usr/local/lsws/logs/error.log
# Search for errors
grep -i error /usr/local/lsws/logs/error.log | tail -20
# Check access patterns
awk '{print $1}' /usr/local/lsws/logs/access.log | sort | uniq -c | sort -rn | head -10