Skip to content

Logs#

Server Log#

The RSPM server log is located at /var/log/rstudio/rstudio-pm/rstudio-pm.log. This file is owned by rstudio-pm with permissions 0600.

If logrotate is available when RSPM is installed, a logrotate configuration will be installed. The default configuration is to rotate the logfile daily. The old log file will be stored alongside the original with a numeric extension, .1, .2, etc. The rotated log files are compressed after one day. The .1 log file is retained uncompressed, but older logs are compressed. Most systems use gzip for compression, giving log files with extensions like .2.gz, .3.gz. Logs will be maintained for 30 days.

The manual for logrotate has more information.

The log regions shown in the server log are controlled by the Debug.Log configuration property, which is documented in more detail in the configuration appendix.

[Debug]
Log = git
Log = route
Log = sync

Additionally, regions can be temporarily enabled or disabled using the rspm config debug logger command.

Terminal

rspm config debug logger activate git

Service Log#

RSPM can log information about serving source and binary packages. To enable the service log, define the Server.ServiceLog configuration property.

[Server]
ServiceLog = "/var/log/rstudio/rstudio-pm/rstudio-pm.service.log"

The service log file is owned by rstudio-pm with permissions 0600. The log file is stored in JSON format, with each row being a valid JSON object.

Service Log Properties#

Each row of the service log is a valid JSON object. The following properties may be included.

time

A timestamp that identifies when the request was initiated.

Type: string

Appears: all logs

name

The name of the package that was requested.

Type: string

Appears: all logs

version

The version of the package that was requested.

Type: string

Appears: all logs

class

Set to one of the following

  • current - A current source package request.
  • archived - An archived source package request.
  • binary_win - A Windows binary package request.

Type: string

Appears: all logs

source

Set to the source name for the current package request. This is useful for determining which source a package originates from, particularly when a repo contains multiple sources.

Type: string

Appears: all logs

type

Indicates one of the following request types

  • source_archived - The request is for an archived package source.
  • source_current - The request is for a current package source.
  • binary_archived - The request is for an archived package binary.
  • binary_current - The request is for a current package binary.

Type: string

Appears: all logs

distro

For package binary requests, indicates the distro requested. When R is configured to use Linux binaries, the distro is the URL segment that directly follows __linux__/. On Windows, the distro indicates the R version, e.g., 3.5-win.

Type: string

Appears: binary requests only

r_version

For package binary requests, indicates the R version requested. The R version is indicated in the User-Agent header value.

Type: string

Appears: binary requests only

match_type

For package binary requests, indicates one of the following match types.

  • exact - The User-Agent R version matches the distro's default R version exactly.
  • best - A best-matching R version was calculated based on the User-Agent header value.
  • forced - The User-Agent R version's minor version matches the minor version of the distro's R version, and the distro was configured to force using its R version.

Type: string

Appears: binary requests only

failed_service

The presence of this property indicates a service failure. If the log line includes a message property of ok, then a failed_service property indicates that a package binary request was unsuccessful, but the service was able to successfully fall back to serving the package source. However, if the log line's message property includes an error message, then the request failed.

Service failure values include:

  • service_error_ash - Failure while calculating the unique signature (ASH) for a package binary.
  • service_error_fetch - Failure while fetching package binary or source files from storage.

Type: string

Appears: failed and source fallback requests (service failure related)

failed_ua

For package binary requests, the presence of this property property indicates a User-Agent failure. User-Agent failures include:

  • ua_error_none - No User-Agent header was found.
  • ua_error_unsupported_os - The User-Agent header value indicates an OS that is not supported.
  • ua_error_no_r - The User-Agent header value does not indicate the R version.
  • ua_error_distro_mismatch - The OS indicated by the User-Agent header value does not match the OS for the distro.

Type: string

Appears: User-Agent-related source fallback requests

user_agent

For User-Agent failures, the User-Agent header value is included for reference.

Type: string

Appears: User-Agent-related source fallback requests

failed_match

For package binary requests, the presence of this property property indicates a failure related to calculating a best-matching R version. Values include:

  • match_error_no_best_match - No matching R version was found.
  • match_error_force_mismatch - The R version is being forced by the distro, but the distro's minor version does not match the minor version indicated by the User-Agent header.

Type: string

Appears: Match-related source fallback requests

error

For service failures that result in falling back to serving source, an error property may be included to indicate an error message associated with the service failure.

Type: string

Appears: source fallback requests (service failure related)

message

For requests ending in failure, the error message is indicated by the message property. All other requests, including requests for binaries that successfully fall back to source due to one of the above failure modes, will return a value of ok.

Type: string

Appears: all logs

Service Log Examples#

Below are examples of typical service logs.

  • Serving a current package binary where the R version indicated by the User-Agent header is an exact match for the distro identifier's default R version.

    {
        "time": 1563907491,
        "name": "plumber",
        "version": "0.4.6",
        "class": "current",
        "type": "binary_current",
        "distro": "bionic",
        "r_version": "3.5.2",
        "match_type": "exact",
        "message": "ok"
    }
    
  • Serving a current package binary where the R version indicated by the User-Agent header is a "best" match for the distro identifier's default R version.

    {
        "time": 1563907529,
        "name": "plumber",
        "version": "0.4.6",
        "class": "current",
        "type": "binary_current",
        "distro": "bionic",
        "r_version": "3.5.3",
        "match_type": "best",
        "message": "ok"
    }
    
  • A current package binary was requested, but was not available to download. RSPM automatically fell back to serving the package source, which succeeded.

    {
        "time": 1563907544,
        "name": "plumber",
        "version": "0.4.6",
        "class": "current",
        "type": "binary_current",
        "distro": "bionic",
        "r_version": "3.6.3",
        "match_type": "best",
        "error": "DownloadBinaryEtagRunner: file not found: https://rspm-sync.rstudio.com/bin/3.6-bionic/e3f8ab6d0bd9f83cb787b4f7472d60d98f247f64ea2c8a32aff68be6abbde5cf.tar.gz",
        "failed_service": "service_error_fetch",
        "message": "ok"
    }
    
  • A current package binary was requested, but no best-matching binary was available for R 3.7.3. RSPM automatically fell back to serving the package source, which succeeded.

    {
        "time": 1563907562,
        "name": "plumber",
        "version": "0.4.6",
        "class": "current",
        "type": "binary_current",
        "distro": "bionic",
        "r_version": "3.7.3",
        "failed_match": "match_error_no_best_match",
        "message": "ok"
    }
    
  • A current package binary was requested, but the User-Agent header did not indicate an R version. RStudio Package Manager automatically fell back to serving the package source, which succeeded. Note that the user_agent property is included in this case to aid in debugging.

    {
        "time": 1563907598,
        "name": "plumber",
        "version": "0.4.6",
        "class": "current",
        "type": "binary_current",
        "distro": "bionic",
        "failed_ua": "ua_error_no_r",
        "user_agent": "Q (3.5.3 x86_64-pc-linux-gnu x86_64 linux-gnu)",
        "message": "ok"
    }
    
  • A current package binary was requested, but the User-Agent header indicated an unsupported OS. RStudio Package Manager automatically fell back to serving the package source, which succeeded. Note that the user_agent property is included in this case to aid in debugging.

    {
        "time": 1564757046,
        "name": "plumber",
        "version": "0.4.6",
        "class": "current",
        "type": "binary_current",
        "distro": "xenial",
        "failed_ua": "ua_error_unsupported_os",
        "user_agent": "python-requests/2.9.1",
        "message": "ok"
    }
    
  • Serving a current package source.

    {
        "time": 1563907590,
        "name": "plumber",
        "version": "0.4.6",
        "class": "current",
        "type": "source_current",
        "message": "ok"
    }
    

Access Logs#

The RSPM HTTP access logs are located at /var/log/rstudio/rstudio-pm/rstudio-pm.access.log. This file is owned by rstudio-pm with permissions 0600. Log files are stored in Apache Combined Log Format.

You can switch to the Apache Common Log Format if preferred by setting Server.AccessLogFormat = "common".

If logrotate is available when RSPM is installed, a logrotate configuration will be installed. The default configuration is to rotate the logfile daily. The old logfile will be compressed and stored alongside the original log file with a .1.gz extension (then .2.gz, etc.). Logs will maintained for 30 days.

Note

For information on the differences between the Apache Combined Log Format and the Apache Common Log Format see Apache's documentation here.