ยง2024-12-20

When you start rserver the `Logging configuration loaded from '/etc/rstudio/logging.conf'. Logging to 'syslog'.

/etc/rstudio/logging.conf

[*]
log-level=info
logger-type=syslog

[@rserver]
log-level=debug
logger-type=file
max-size-mb=10
rotate-days=2
max-rotations=50
delete-days=10
warn-syslog=0

[file-locking]
# log-dir=/var/log/file-locking
log-file-mode=600
log-dir=/var/log/rstudio/rstudio-server
# Can be 0 (false) or 1 (true), default  1 (true)
rotate=1
# Maximum allowable size of the file before it is rotated. Only applicable if rotate is enabled. Default 2(MB)
max-size-mb=2
# rotate-days	Number of days before a log file is rotated. Set to 0 to disable rotation by time. Only applicable if rotate is enabled.	1
rotate-days=1
# max-rotations	Number of maximum log rotation files that can be created. Set to 0 to allow an unbounded amount of rotated log files.	100
max-rotations=7
# delete-days Number of days before a rotated log file is deleted. Set to 0 to disable deletion of old log files. Only applicable if rotate is enabled.	30
delete-days=30
# warn-syslog	Whether or not to also send warn/error logs to syslog in addition to file for better admin visibility.	1 (true)
warn-syslog=1

Default log file locations

`/var/log/rstudio/rstudio-server`

create directory

$ sudo mkdir -p /var/log/rstudio
$ sudo chown -R rstudio-server:rstudio-server /var/log/rstudio
$ sudo chmod 755 /var/log/rstudio

Config Option Description Default Value log-dir The log directory to store log files in. The resulting log file name is based on the executable name (and optionally the process ID). /var/log/rstudio/rstudio-server log-file-mode The filemode to use when creating the log file. Must be a valid POSIX octal file mode. 666 (All read/write) log-file-include-pid Whether to include the process id in the filename. Useful for differentiating between multiple processes of the same name. Can be 0 (false) or 1 (true) 0 (false) rotate Whether or not to rotate the log file as it reaches maximum size. Can be 0 (false) or 1 (true) 1 (true) max-size-mb Maximum allowable size of the file before it is rotated. Only applicable if rotate is enabled. 2 (MB) rotate-days Number of days before a log file is rotated. Set to 0 to disable rotation by time. Only applicable if rotate is enabled. 1 max-rotations Number of maximum log rotation files that can be created. Set to 0 to allow an unbounded amount of rotated log files. 100 delete-days Number of days before a rotated log file is deleted. Set to 0 to disable deletion of old log files. Only applicable if rotate is enabled. 30 warn-syslog Whether or not to also send warn/error logs to syslog in addition to file for better admin visibility. 1 (true)