> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coralos.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Logging

export const ServerConfigSingle = ({table, config, example}) => {
  let hyphens = config.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);
  let underscores = config.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`);
  return <CodeGroup>
            <CodeBlock filename="Command line">
                <span>--{table}.{hyphens}={example}</span>
            </CodeBlock>

            <CodeBlock filename="Config file">
                <span>{table}.{underscores} = {example}</span>
            </CodeBlock>
        </CodeGroup>;
};

# Log buffer size

<Badge color="blue">default</Badge> `32768` <br />

<ServerConfigSingle table="logging" config="logBufferSize" example="1000" />

The maximum number of log entries to keep in memory. This buffer is used for all log messages, including those sent by
agents. Note that the Coral console log view for an agent only applies a filter to the log buffer, so, if you desire
1000 log entries per agent, the buffer must be `1000` x `number of agents` + extra for system log entries.

Consider adjusting this value only after you experience loss of log entries in the Coral console.

# Max replay

<Badge color="blue">default</Badge> `2048` <br />

<ServerConfigSingle table="logging" config="maxReplay" example="1000" />

The maximum number of log entries that will be sent to a new subscriber. Note that opening a Coral console agent log
view counts as a new subscription; this value caps the number of messages that appear in that view.

# Console log level

<Badge color="blue">default</Badge> `INFO` <br />

<ServerConfigSingle table="logging" config="consoleLogLevel" example="&#x22;TRACE&#x22;" />

The maximum log level that will be printed to the server's console.

Valid values, in order of increasing verbosity:

* `ERROR`
* `WARN`
* `INFO`
* `DEBUG`
* `TRACE`

# File log level

<Badge color="blue">default</Badge> `INFO` <br />

<ServerConfigSingle table="logging" config="fileLogLevel" example="&#x22;TRACE&#x22;" />

The maximum log level that will be printed to the disk. Note [enable file logging](#enable-file-logging) must be true to
write any messages to disk.

Valid values, in order of increasing verbosity:

* `ERROR`
* `WARN`
* `INFO`
* `DEBUG`
* `TRACE`

# Enable file logging

<Badge color="blue">default</Badge> `true` <br />

<ServerConfigSingle table="logging" config="logToFileEnabled" example="false" />

If this is true, log messages will be written to a file on disk. The directory, number of log files, log file size and
other file logging options are further configurable using:

* [Log files directory](#log-files-directory)
* [Log file name](#log-file-name)
* [Log file name pattern](#log-file-pattern)
* [Max history](#max-history)
* [Log total size cap](#log-total-size-cap)
* [Clear log files on server start](#clear-log-files-on-server-start)
* [Max file size](#max-file-size)
* [File log level](#file-log-level)

# Log files directory

<Badge color="blue">default</Badge> `${HOME}/.coral/logs` <br />

<ServerConfigSingle table="logging" config="logFilesDirectory" example="&#x22;/var/log/coral&#x22;" />

The directory where log files will be written. Note that the full path to a given log file may be different from the
value of this setting, see:

* [Log file name](#log-file-name)
* [Log file name pattern](#log-file-pattern)

# Log file name

<Badge color="blue">default</Badge> `${logFilesDirectory}/server.log` <br />

<ServerConfigSingle table="logging" config="logFileName" example="&#x22;/var/log/coral/server.log&#x22;" />

The full path to the log file.  Read more [here](https://logback.qos.ch/manual/appenders.html#fileAppenderFile).

# Log file name pattern

<Badge color="blue">default</Badge> `${logFilesDirectory}/archive/%d{yyyy/MM, aux}/%d{yyyy-MM-dd}.%i.log.gz` <br />

<ServerConfigSingle table="logging" config="logFileNamePattern" example="&#x22;/var/log/coral/archive/%d{yyyy/MM, aux}/%d{yyyy-MM-dd}.%i.log.gz&#x22;" />

The pattern for archived log files. Read more [here](https://logback.qos.ch/manual/appenders.html#tbrpFileNamePattern).

# Max history

<Badge color="blue">default</Badge> `12` <br />

<ServerConfigSingle table="logging" config="maxHistory" example="20" />

The maximum number of archived log files to keep. Read more [here](https://logback.qos.ch/manual/appenders.html#tbrpMaxHistory).

# Log total size cap

<Badge color="blue">default</Badge> `3GB` <br />

<ServerConfigSingle table="logging" config="logTotalSizeCap" example="&#x22;1GB&#x22;" />

The maximum total size of all archived log files. Read more [here](https://logback.qos.ch/manual/appenders.html#tbrpTotalSizeCap).

# Clear log files on server start

<Badge color="blue">default</Badge> `false` <br />

<ServerConfigSingle table="logging" config="logClearHistoryOnStart" example="true" />

If this is true, archived log files that are configured to be deleted will be deleted when the server starts. Read more [here](https://logback.qos.ch/manual/appenders.html#tbrpCleanHistoryOnStart).

# Max file size

<Badge color="blue">default</Badge> `10MB` <br />

<ServerConfigSingle table="logging" config="maxFileSize" example="&#x22;5MB&#x22;" />

The maximum size of the current log file; when the current log file hits this size, the log file will be archived. Read more [here](https://logback.qos.ch/manual/appenders.html#maxFileSize).
