Vespa log files

All Vespa components use a common log module for logging. These log messages are added to a local log file in $VESPA_HOME/logs/vespa/ and filtered, then forwarded, to the log server on the administration node. The log archive and rotation is explained in log server.

Log file fields

Log files are in a machine-readable log format, made more human-readable by vespa-logfmt - it can filter out log messages from specific programs, only show certain log levels, print the time in a more directly understandable format and so on. Each line that is logged consists of the following fields, in order, separated by a TAB (ASCII 9) character:

time host pid service component level message
Log fieldDescription
time Time in seconds since 1970-01-01 UTC, with optional fractional seconds after. E.g. 1102675319.726342
host The hostname of the machine that produced this log entry
pid The process id, and an optional thread-id of the process/thread that logged the message
service The Vespa service name of the logger
component The component name that logged. An application may have many different sub-components with their own component names, usually starts with the name of the binary
level One of fatal, error, warning, info, config, event, debug, or spam
message The log message itself. All dangerous characters are escaped (CR, NL, TAB, \, ASCII < 32 and ASCII 128..159)
Log levelDescription
fatal Fatal error messages. The application must exit immediately, and restarting it will not help
error Error messages. These are serious, the application cannot function correctly
warning Warnings - the application may be able to continue, but the situation should be looked into
info Informational messages that are not reporting error conditions, but should still be useful to the operator
config Configuration settings
event Machine-readable events. May contain information about processes starting and stopping, and various metrics
debug Debug messages - normally suppressed
spam Very low-level debug messages, normally suppressed. Generates massive amounts of logs when enabled

Writing logs

Code can have many DEBUG-level log lines - include a simple check to speed up execution:

if(log.isLoggable(LogLevel.DEBUG)) then log ...

Controlling log levels

Vespa programs running as services can have their active log levels modified at run-time by the vespa-logctl program. Standalone programs will instead read the environment variable VESPA_LOG_LEVEL on startup to determine which log levels should be active.

The default setting for VESPA_LOG_LEVEL is "all -debug -spam", which enables all log levels except debug and spam.

vespa-logctl can alter the active log levels for a program, or for parts of a program, while it is running. This is especially useful for enabling debug output in parts of a live system for diagnosing problems. It can also be used to silence programs that are too verbose in their logging.

vespa-logctl -h shows how to use the program. Programs that can be controlled by vespa-logctl put log control files in $VESPA_HOME/var/db/vespa/logcontrol/service.logcontrol. If this file exists on program startup, it will be used to set the logging levels. This means that log level modifications done with vespa-logctl are sticky, and can also be performed even if the program is not running.

Log events

Event messages are log messages of the event type. Events contain a well-defined payload which makes them suitable for automated processing of various kinds, like alerting. An event is emitted by a component when something of interest happens to it, or when it has some metric data it wants to share with the world. As all other log messages, events are collected to the admin nodes by the logserver component, where they may be found in the Vespa log or intercepted programmatically by a logserver plugin.

Metrics are used to report on internal variables detailing the processing performed by a particular component. VALUES are numbers with momentarily significance, such as queue lengths and latencies. COUNTER are numbers increasing monotonically with each processing step, such as number of documents processes, or number of queries. Refer to the metrics API and container metrics.

Each event has an event type, a version and an optional payload. In the log format, event types are expressed as a single word, versions as a simple integer, and the payload as a set of key=value pairs. The event payload is backslash-quoted just like log messages are in general. This means that events may be double-quoted during transport. Double-quote delimiters are not supported.

starting Payload: name=<name>
This event is sent by processes when they are about to start another process. Typical for, but not limited to, shell scripts. This event is not required to track processes, but is useful in cases where a sub-process may fail during startup. Example:
starting qrserver for default/container.0
started Payload: name=<name>
The started event is sent by a service that just started up. Example:
started/1 name="vespa-proton"
stopping Payload: name=<name> why=<why>
The stopping event is sent by a process that is about to exit. Example:
stopping/1 name="vespa-proton" why="clean shutdown"
stopped Payload: name=<name> pid=<pid> exitcode=<exitcode>
This event is sent by a process monitoring when a sub-process exits. Example:
stopped/1 name="vespa-proton" pid=14523 exitcode=0
crash Payload: name=<name> pit=<pid> signal=<signal>
Submitted by a process monitoring a sub-process when the sub-process crashes (dumps core etc.). Example:
crash/1 name="vespa-proton" pid=12345 signal=11
count Payload: name=<name> value=<value>
General event for counts - for tracking any type of counter metric. The name is specific to each library/application. Counters are assumed to increase with time, counting the number of events since the program was started. Example:
count/1 name="queries" value=10
value Payload: name=<name> value=<value>
General event for values - for tracking any type of value metric. Value is for values that cannot be counts. Typical values are queue lengths, transaction frequencies and so on. Example:
value/1 name="peak_qps" value=200
state Payload: name=<name> value=<value>
General event for components in a process. value contains a string with more detailed information on what has happened. Note that the format and content of such strings can change between releases. Example:
state/1 name="transactionlog.replay.start" value="{"domain":"test","serialnum":{"first":1,"last":1000}}"


Details here on how local log rotation and forward to log server is done by logd

Log server

On the log server on the administration node, the Archiver plugin will write the log messages from each node to a log archive. These messages are written to the log file based on the message timestamp. The log files are located in the $VESPA_HOME/logs/vespa/logarchive directory. The catalog structure is like:

For instance will a message logged at 2016-07-22 08:05:00 be found in:
All dates and times are in UTC. If the log file exceeds 20 Mb, the file will be rotated and the serial number will increase. These files are the same that are available through the web interface.

The log archive might grow large - to disable storing of metrics in log archive, set the vespa_log_server.archive_metric environment setting to off. If you later need to debug using metric data, aggregate these by hand from the individual nodes in the system.

Events are normally filtered before sending to the log archive. To forward, add to services.xml:

<config name="cloud.config.log.logd">

Real-time log monitoring

One of the standard plugins in the log server is the Replicator plugin. This plugin is able to replicate log messages to other interested services or parties. To use this plugin, telnet to port 19083 on the log server. Use the vespa-model-inspect to verify that the logserver has a port tagged with 'telnet logtp' at 19083.

$ telnet host 19083
After connecting, you can apply a message filter. To list the message filters available, simply write list. To apply a message filter, use use <filter>, like:
Connected to host.
Escape character is '^]'.
# 203 filter list
# 204 system.all - Match all log messages
# 204 system.metricsevents - Match all Count and Value messages
# 204 system.allevents - Match specific log levels
# 204 system.nometricsevents - Matches all log messages except Count and Value events
# 204 system.mute - Matches no messages.  Mute.
# 205 end filter list
use system.all
# 200 using ''

Access log file content

The Search Container logs each query in its access log. The log files are named QueryAccessLog.<timestamp> and is found in $VESPA_HOME/logs/vespa/qrs/. In the default 'vespa' format, each line that is logged consists of the following fields, in order, separated by a space character:

SourceIP - - [Date] "HTTPRequest" HTTPReturnCode ByteCount "Referrer" "UserAgent" ProcessingTime TotalHitCount 0 HitCount
Log fieldDescription
SourceIP IP address of client
- Nothing
- Nothing
Date Timestamp (localtime) when query was executed with offset from GMT
HTTPRequest HTTP request string
HTTPReturnCode HTTP return code for the query
  • 200 for ok
ByteCount Number of bytes sent to the client
Referrer HTTP referrer string
UserAgent Client user agent
ProcessingTime Time used to process the query in seconds. Including query parsing, back end execution. Does not include query reception from client and result set transfer time to client.
TotalHitCount The total number of hits for the result set.
0 Reserved for later expansion - always 0
HitCount Number of hits in the query result page. Note that the number of grouping results (if there are any) is included in this number
Example log entry (timestamp offset -0800 is equal to PST): - - [24/Jan/2008:05:29:04 -0800] "GET search/?query=yahoo HTTP/1.1" 200 270 ""
  "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7" 2.792 1 0 1
If more detailed logging is needed, configure access logging in JSON. This format also allows logging of custom fields - see access logging in JSON.

Time values in the access log compared to metrics and log events

The timing in the access log will in general be slightly off compared to the timing values in the vespa.log. The reason is the “probes” into the system are placed at slightly different levels of abstraction. The explanations here are directed at experienced users and troubleshooting.

Definition of processing time in the access log

Processing time in the access log starts when the execution is first invoked from the search handler. The end is dependent on whether the response is asynchronous or not. For a synchronous response, the end is after the renderer has been invoked, but before the rendering buffer is flushed. For an asynchronous response, e.g. a normal search response, the end is defined as when the completion handler is created. That means after control flow has returned from the search chains, but before any network traffic or rendering has been done.

Definition of processing time in the vespa.log

StatisticsSearcher defines the metric query_latency and the log event mean_query_latency. The data fed into these is identical. The start of the interval is defined as when the control flow enters StatisticsSearcher, the end as when the next searcher after StatisticsSearcher returns from search(). This has the side effect of not including fill time if the result was not already filled when passed on from StatisticsSearcher. This may happen if the SearchHandler has to invoke fill() itself, e.g. if no searchers need to access hit fields.

Timing summary

The access log includes everything happening before rendering, but will exclude expensive rendering logic and slow networks. The query latency event and metrics only covers what happens inside the search chain where StatisticsSearcher is placed, and may exclude summary fetching.

ZooKeeper Log

The ZooKeeper log file is normally not necessary to monitor on a regular basis, but is mentioned here as a possible source of information in case you should ever need to debug the Vespa configuration system. Is is located at $VESPA_HOME/logs/vespa/zookeeper.<servicename>.log.