Logging Directives
The following directives configure logging.
log_file
Description | The name of the file to log to |
Syntax | log_file filename |
Context | global |
Default | none |
The name of a log file where RealityServer will write the complete message log as it would normally appear on the console. By default, no log file is written and log rotation has no effect. It is also possible to overwrite a configured log file from the command line.
log_rotation_time
Description | When to rotate log files |
Syntax | log_rotation_time rotation |
Context | global |
Default | today,00:30,24:00 |
If set to a non-empty string, enables log file rotation at fixed times. Log file rotation means that the current log file is renamed and a new one is started to ensure that the log file does not grow forever. If nonempty, the string must have the format "MM/DD/YYYY,HH:MM,HH:MM". The date and first time specify the first date at which the log is rotated, and the final time specifies the interval (HH may be greater than 23 here). As a special case, the initial date can be today. For example, "today,00:30,24:00" means rotate daily 30 minutes past midnight; "04/22/2007,18:00,168:00" means rotate weekly (168=7*24) on every Sunday (April 22, 2007 is a Sunday) at 18:00 (6pm).
When log file rotation is triggered the current log file, EG: rs_log, gets rotated to rs_log.0. All other logfiles are rotated from rs_log.X to rs_log.X+1.
log_rotation_file_size
Description | Rotate log files when they reach a given size |
Syntax | log_rotation_file_size size |
Context | global |
Default | 200 |
This variable puts a limit on the size of each log file. Numbers are in megabytes. The default means that the log will be rotated when the file size exceeds 200 MB. Sizes are approximate.
log_rotation_directory_size
Description | Purge log files when the log directory exceeds the given size |
Syntax | log_rotation_directory_size size |
Context | global |
Default | 20000 |
This variable puts a limit on the total size of the log file directory. Numbers are in megabytes. The default means that the directory named by the directory part of the log file will not exceed 20 GB.
When directory rotation is triggered RealityServer will delete log files (starting from the oldest) until the directory size restriction is met. Note that it will never delete the current log file, even if this would be required to meet the directory size restriction.
http_log_file
Description | The name of the file to log http requests to |
Syntax | http_log_file filename |
Context | global |
Default | none |
The name of a log file where RealityServer will write a report of all incoming URL requests. The report is in Apache log format. If the file exists, it is appended to. The file is never truncated and will grow forever. Different hosts may not write to the same file on a shared file server because there is no protection against concurrent writes. If this setting is missing or the name is empty, no log is written and log rotation has no effect. It is also possible to overwrite a configured http log file from the commandline.
http_log_rotation_time
Description | When to rotate http log files |
Syntax | http_log_rotation_time rotation |
Context | global |
Default | today,00:30,24:00 |
If set to a non-empty string, enables HTTP log file rotation at fixed times. Log file rotation means that the current HTTP log file is renamed and a new one is started to ensure that the HTTP log file does not grow forever. If nonempty, the string must have the format "MM/DD/YYYY,HH:MM,HH:MM". The date and first time specify the first date at which the log is rotated, and the final time specifies the interval (HH may be greater than 23 here). As a special case, the initial date can be today. For example, "today,00:30,24:00" means rotate daily 30 minutes past midnight; "04/22/2007,18:00,168:00" means rotate weekly (168=7*24) on every Sunday (April 22, 2007 is a Sunday) at 18:00 (6pm).
http_log_rotation_file_size
Description | Rotate http log files when they reach a given size |
Syntax | http_log_rotation_file_size size |
Context | global |
Default | 200 |
This variable puts a limit on the size of each log file. Numbers are in megabytes. The default means that the log will be rotated when the file size exceeds 200 MB. Sizes are approximate.
http_log_rotation_directory_size
Description | Purge http log files when the log directory exceeds the given size |
Syntax | http_log_rotation_directory_size size |
Context | global |
Default | 20000 |
This variable puts a limit on the total size of the log file directory. Numbers are in megabytes. The default means that the directory named by the directory part of the log file will not exceed 20 GB.
When directory rotation is triggered RealityServer will delete log files (starting from the oldest) until the directory size restriction is met. Note that it will never delete the current log file, even if this would be required to meet the directory size restriction.
log_priority
Description | Priority of logging for this host |
Syntax | log_priority number |
Context | global |
Default | 0 |
In a cluster of RealityServers not all hosts in the cluster will output log entries. Instead for most types of log entries only one host will output them. This host is called the 'log host'.
An exception is fatal error messages which will be output on the host which issued them. This is done because the host might not be able to send them to the log host anymore, because of the fatal condition.
The log priority controls which host will become the log host in a cluster. The host with the highest log priority in a cluster is the log host. If a new host joins which has a higher priority than the current log host, logging will switch to that host. If the current log host leaves the cluster the host which now has the highest log priority will become the new log host. In case several log hosts have the highest priority all hosts in the cluster will agree on the same log host automatically.
The log priority is specified using the log priority. The preferred log host should have the highest number, and fallbacks in case of problems should have lower numbers, in the preferred order of fallbacks.
log_host
Description | Lists log hosts in priority order |
Syntax | log_host hostnames |
Context | global |
Default | None |
This setting is an alternative to using the log_priority entry to control which host is collecting and outputting the log entries from all hosts.
The entry is a string giving a comma separated list of host names. The first entry in the list is the host which has the highest log priority, the second has the second highest priority etc. The last host listed is given priority 1 and priorities increase monotonically until the first host whose priority is the number of hosts in the list. This list should be the same on all hosts in a cluster. If a host is not in the list, and does not specify a log_priority directly it will be given priority 0.
Any log_priority configuration (via file or command line) will override the implied priority from log_host.
log_timestamp
Description | Adds a timestamp prefix to each log entry |
Syntax | log_timestamp human|epoch|iso|off |
Context | global |
Default | human |
This setting adds a timestamp entry to the start of each log entry.
- human
- Human readable timestamp in format YY/MM/DD HH:MM:SS.
- epoch
- Timestamp in seconds.milliseconds since the system epoch.
- iso
- Timestamp in UTC simplified extended ISO 8601 format YYYY-MM-DDTHH:mm:ss.sssZ. This is equivalent to the Javascript Date.toISOString().
- off
- No timestamp prefixed