Logging

packagecloud:enterprise generates logging information which may be useful in the event of a bug or other issue with the software. Logs are generated to the /var/log/packagecloud directory. There are different logs for each of the various services within the packagecloud:enterprise instance.

Log location

Logs are generated to the /var/log/packagecloud directory.

Application Logging

You can adjust the log level of the packagecloud application by setting the following option in /etc/packagecloud/packagecloud.rb configuration file:

packagecloud_rails['log_level'] = 'error'

The available options are: debug, info, warn, error, fatal. The most verbose logging is "debug" and the least is "fatal" - we recommend using "error" which is the default value and offers a good trade off between verbosity and disk space. Application logs are generated to the /var/log/packagecloud/packagecloud-rails/ directory. There are individual files for various subsystems of the packagecloud:enterprise application.

Available log files and their purpose

There are many log files present in /var/log/packagecloud – the following list will attempt to include the most relevant files, their purpose, and what you can expect to find in them:

Application level logs

  • /var/log/packagecloud/packagecloud-rails/request_log.log   - This file contains a log of all requests made to the service: requests from users against the web-UI andAPI requests. You will find information such as the timestamp a request was made, the IP address the request came from, the HTTP verb, the URL, the HTTP response code from the service, and the parameters of the request.

  • /var/log/packagecloud/packagecloud-rails/resque.log - This file contains detailed logging information about the background job processing system where Debian, RPM, RubyGem, and Python index jobs are queued before being processed. This log will output information showing which jobs were queued, dequeued, and processed along with timestamp information.
  • /var/log/packagecloud/packagecloud-rails/packagecloud.io.log - This file contains application level logs dependent upon the log level set (see the Application Logging section above). With the default settings, this log will contain any errors or exceptions encountered. Note that some error cases (e.g., ActiveRecord::RecordNotFound) may be seen in this file but are not necessarily problematic – some of these errors are handled by the app where it'll render a 404 (or similar) after the error is raised.
  • /var/log/packagecloud/packagecloud-rails/package_create.log - This file contains application level logging related to package creation. If a package is unable to be created and an error is returned (typically a 422), this log will contain additional information as to why, specifically, a package creation returned a 422.

Metadata processing logs

  • /var/log/packagecloud/packagecloud-rails/rubygem_indexer.log - This file contains a log generated by the RubyGem indexer. This log contains timestamps of the various stages of RubyGem package reindexing and can be used to debug RubyGem metadata processing.
  • /var/log/packagecloud/packagecloud-rails/rpm_indexer.log - This file contains a log generated by the RPM indexer.  This log contains timestamps of the various stages of Rpm package reindexing and can be used to debug RPM metadata processing.
  • /var/log/packagecloud/packagecloud-rails/rpm_index_builder.log - This file contains a low-level log generated by the RPM indexer. This log documents the internals of the reindex process. Any debugging work on the Rpm indexer would be better suited by the rpm_indexer.log, but in some rare instances the rpm_index_builder.log may have additional, important information.
  • /var/log/packagecloud/packagecloud-rails/python_indexer.log - This file contains detailed logging information about the Python indexer. This log contains timestamps of the various stages of Python package reindexing and can be used to debug Python metadata processing.
  • /var/log/packagecloud/packagecloud-rails/deb_indexer.log - This file contains a log generated by the Debian indexer. This log contains timestamps of the various stages of Debian package reindexing and can be used to debug Debian metadata processing.

Using logrotate

The /etc/packagecloud/packagecloud.rb file comes with options for setting up logrotate to handle automatic compression and deletion of log files generated by packagecloud:enterprise. The options you can specify in /etc/packagecloud/packagecloud.rb to control logrotate are:

##
## How many logs to keep around
##
logging['logrotate_rotate'] = 30
##
## Compress rotated logs
##
logging['logrotate_compress'] = "compress" # see 'man logrotate'

## Logrotate method (see 'man logrotate')
##
logging['logrotate_method'] = "copytruncate" # see 'man logrotate'
##
## Rotate based on frequency, like "daily", or, nil to rotate only on size
##
logging['logrotate_frequency'] = nil
##
## Rotate based on size
##
logging['logrotate_size'] = "100M"


Check the man page for logrotate for more detailed documentation on how this utility works. You can check the man page by running man logrotate from the command line or by visiting http://www.linuxcommand.org/man_pages/logrotate8.html for more information.