Skip to content

Limit the number of log lines displayed

Boros Gábor requested to merge omar/logging into master

Created by: omarkhan

See OC-1035.

Problem

The interface takes a very long time to load, as it tries to fetch all log entries for all instances and there can be a lot of data sent over the wire.

Solution

This pull request adds a configurable limit on the number of log entries returned in the initial request. You can set the limit using the LOG_LIMIT environment variable (default: 10000).

In addition, loading log entries from the server is deferred until the user actually selects an instance.

Testing

To run the js tests in your development environment, see https://github.com/open-craft/opencraft/pull/39.

To test manually, create a server and instance with some log entries. We can use the test factories for this:

from instance.tests.models.factories.server import OpenStackServerFactory

server = OpenStackServerFactory.create()
server.log_entry_set.create(level='INFO', text='server log message')
server.instance.log_entry_set.create(level='INFO', text='instance log message')

Then, start the dev server with

make rundev

With your web console open, go to http://localhost:5000/ and select the instance we just created. You will see a second request to fetch the log entries.

Merge request reports