# Log Files

## 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.

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.

Event Description
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
The started event is sent by a service that just started up. Example:
started/1 name="vespa-proton"
The stopping event is sent by a process that is about to exit. Example:
stopping/1 name="vespa-proton" why="clean shutdown"
This event is sent by a process monitoring when a sub-process exits. Example:
stopped/1 name="vespa-proton" pid=14523 exitcode=0
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
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
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
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}}"

## Logd

A small program named logd is responsible for rotating the vespa.log file and also forwarding it to the log server. The log file is rotated after 24 hours, or if it grows too large. Rotated logs are removed by logd after 30 days, or if the total size grows above 1000 MB.

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: logarchive/<year>/<month>/<day>/<hour>-<serial>  For instance will a message logged at 2016-07-22 08:05:00 be found in: logarchive/2016/07/22/08-0  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. Rotated log files more than two hours old, will be compressed to save disk space. Archived log files in the log archive will be deleted for two reasons: • Log file is more than 30 days old • The full size of the log archive exceeds 30GB Events are normally filtered before sending to the log archive. To forward, add to services.xml: <services> <config name="cloud.config.log.logd"> <loglevel> <event> <forward>true</forward> </event> </loglevel> </config>  ## Access log file content The Container logs each request in its access log. The log files are found in$VESPA_HOME/logs/vespa/access/. See access logging for details.

### 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 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 both is the same. 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. It is located at \$VESPA_HOME/logs/vespa/zookeeper.<servicename>.log.