Mattermost, Inc.

[SOLVED] Logging does not rotate after 10k lines

Summary

logging does not rotate after 10k lines

Steps to reproduce

Version: 4.6.0
Build Number: 4.6.1
Build Date: Tue Jan 30 22:08:22 UTC 2018
Build Hash: cc82749d4f8c47bce201123aedcd8c564ceffcb8
Build Enterprise Ready: true
DB Version: 4.6.0
Enterprise Edition running with E20 license

config.json reads:

"LogSettings": {
    "EnableConsole": false,
    "ConsoleLevel": "INFO",
    "EnableFile": true,
    "FileLevel": "INFO",
    "FileFormat": "",
    "FileLocation": "/var/log/mattermost",
    "EnableWebhookDebugging": false,
    "EnableDiagnostics": true
},

Docs say, the log file is rotated after 10000 lines:
https://docs.mattermost.com/administration/config-settings.html#output-logs-to-file

Expected behavior

The log file is rotated after 10000 lines, starting a new one.

Observed behavior

There is only one file growing over 10k lines:

14:09 mattermost@mattermost01 [lej]:/var/log/mattermost$ ll
total 5080
drwxr-x---  2 mattermost mattermost    4096 Jan 31 15:43 ./
drwxr-xr-x 14 root       syslog        4096 Feb 12 07:35 ../
-rw-r-----  1 mattermost mattermost 5193115 Feb 15 14:09 mattermost.log

14:09 mattermost@mattermost01 [lej]:/var/log/mattermost$ wc -l mattermost.log 
25796 mattermost.log

There are no errors or other hints, why it doesn’t rotate the log.
Do I miss there anything?

Hi @tmu-sprd,

Thanks for your report,

We believe this is a bug so have opened a ticket here to investigate and track.

Thank you, @lindy65,

the same applies to Version 4.7.0 and 4.7.1. Initial installed version was 4.5.0 and was patched up through 4.6.0 and 4.6.1.
I’m happy to provide more information, if needed.

Thanks for the additional information @tmu-sprd,

I’ve linked this issue to the Jira ticket so the devs can chime in here if there’s any other information they need :slight_smile:

Just as follow-up:
MM is rotating logs after ~50k lines.

root@mattermost01 [lej] /var/log/mattermost # l
total 23132
drwxr-x---  2 mattermost mattermost     4096 May 17 10:33 .
drwxr-xr-x 14 root       syslog         4096 May 27 07:35 ..
-rw-r-----  1 mattermost mattermost  1431997 May 28 07:08 mattermost.log
-rw-r-----  1 mattermost mattermost 11645866 May 17 10:33 mattermost.log.1
-rw-r-----  1 mattermost mattermost 10581911 Mar 12 15:36 mattermost.log.2
root@mattermost01 [lej] /var/log/mattermost # wc -l mattermost.log.2 
55269 mattermost.log.2
root@mattermost01 [lej] /var/log/mattermost # wc -l mattermost.log.1
50155 mattermost.log.1

In docs it’s removed, that lines were rotated after 10k: https://github.com/mattermost/docs/commit/f0f68d09580df2af3f4171b5e8f3b1cd0929e4a2

For me, this is solved.
Thank you.

Side note: The log file does not have a time stamp as documented. But that’s a different topic.