Kolibri: log archive directory doesn't have the correct number of files

Created on 25 Oct 2019  Â·  2Comments  Â·  Source: learningequality/kolibri

Observed behavior

In the log archive directory, when backup count is set to 30, the log txts are not the latest 30 day logs. Instead, the directory contains 31 files.

Expected behavior

The number of archived log files should match with the number defined.

User-facing consequences

It will take a bit more user storage having one more file. Also users will get confused when the number of files doesn't match with the number they define.

Errors and logs

-rwxrwxrwx 1 root root  44133 Sep 23 19:00 kolibri-2019-09-22.txt
-rwxrwxrwx 1 root root  39705 Sep 24 17:00 kolibri-2019-09-23.txt
-rwxrwxrwx 1 root root  44133 Sep 25 19:00 kolibri-2019-09-24.txt
-rwxrwxrwx 1 root root  44133 Sep 26 19:00 kolibri-2019-09-25.txt
-rwxrwxrwx 1 root root  44335 Sep 27 19:00 kolibri-2019-09-26.txt
-rwxrwxrwx 1 root root  44133 Sep 28 19:00 kolibri-2019-09-27.txt
-rwxrwxrwx 1 root root  44133 Sep 29 19:00 kolibri-2019-09-28.txt
-rwxrwxrwx 1 root root  44133 Sep 30 19:00 kolibri-2019-09-29.txt
-rwxrwxrwx 1 root root  44133 Oct  1 19:00 kolibri-2019-09-30.txt
-rwxrwxrwx 1 root root  28393 Oct  2 19:00 kolibri-2019-10-01.txt
-rwxrwxrwx 1 root root  28393 Oct  3 19:00 kolibri-2019-10-02.txt
-rwxrwxrwx 1 root root 113250 Oct  4 23:52 kolibri-2019-10-03.txt
-rwxrwxrwx 1 root root  50292 Oct  8 23:51 kolibri-2019-10-04.txt
-rwxrwxrwx 1 root root      0 Oct  5 23:36 kolibri-2019-10-05.txt
-rwxrwxrwx 1 root root   8856 Oct  6 23:00 kolibri-2019-10-06.txt
-rwxrwxrwx 1 root root  24354 Oct  7 23:00 kolibri-2019-10-07.txt
-rwxrwxrwx 1 root root      0 Oct  9 23:03 kolibri-2019-10-09.txt
-rwxrwxrwx 1 root root  30996 Oct 10 23:00 kolibri-2019-10-10.txt
-rwxrwxrwx 1 root root  42066 Oct 11 23:00 kolibri-2019-10-11.txt
-rwxrwxrwx 1 root root      0 Oct 12 23:20 kolibri-2019-10-12.txt
-rwxrwxrwx 1 root root    192 Oct 14 00:00 kolibri-2019-10-13.txt
-rwxrwxrwx 1 root root  44133 Oct 15 19:00 kolibri-2019-10-14.txt
-rwxrwxrwx 1 root root  44133 Oct 16 19:00 kolibri-2019-10-15.txt
-rwxrwxrwx 1 root root   2214 Oct 17 19:00 kolibri-2019-10-16.txt
-rwxrwxrwx 1 root root  44133 Oct 18 19:00 kolibri-2019-10-17.txt
-rwxrwxrwx 1 root root      0 Oct 19 19:13 kolibri-2019-10-18.txt
-rwxrwxrwx 1 root root  44332 Oct 20 19:00 kolibri-2019-10-19.txt
-rwxrwxrwx 1 root root   2214 Oct 21 12:00 kolibri-2019-10-20.txt
-rwxrwxrwx 1 root root   2067 Oct 22 00:00 kolibri-2019-10-21.txt
-rwxrwxrwx 1 root root  62044 Oct 23 00:00 kolibri-2019-10-22.txt

Steps to reproduce

have log rotation for 32 days and find out there are 31 log files in archive directory

Context

Kolibri version: 0.12.9a1
Operating system: Ubuntu

backend P2 - normal beginner friendly bug

Most helpful comment

Hi @muhammadalics, the logs are generated using the logging handler with the class KolibriTimedRotatingFileHandler(https://github.com/learningequality/kolibri/blob/develop/kolibri/utils/logger.py#L14 and https://github.com/learningequality/kolibri/blob/develop/kolibri/utils/logger.py#L176). My assumption is that the issue might come from this part of the code: https://github.com/learningequality/kolibri/blob/develop/kolibri/utils/logger.py#L49-L52, but I might be wrong though...

All 2 comments

Is this log generated using shell? Would you be able to provide more color please?

Hi @muhammadalics, the logs are generated using the logging handler with the class KolibriTimedRotatingFileHandler(https://github.com/learningequality/kolibri/blob/develop/kolibri/utils/logger.py#L14 and https://github.com/learningequality/kolibri/blob/develop/kolibri/utils/logger.py#L176). My assumption is that the issue might come from this part of the code: https://github.com/learningequality/kolibri/blob/develop/kolibri/utils/logger.py#L49-L52, but I might be wrong though...

Was this page helpful?
0 / 5 - 0 ratings