Skip to content

[Feature] Provide a configuration option for logs rotation #114

@gituser

Description

@gituser

System information

Geth version: 1.0.6
OS & Version: Linux
Commit hash : latest release

Expected behaviour

Currently, geth creates every hour a new log file even if you set the MaxBytesSize to relatively large value (e.g. 100MB), e.g.:

[Node.LogConfig]
FileRoot = ""
FilePath = "bsc.log"
MaxBytesSize = 104857600
Level = "info" 

This results in:

-rw-r--r-- 1 bsc bsc 318390 Mar 12 17:00 bsc.log.2021-03-12_16
-rw-r--r-- 1 bsc bsc 317626 Mar 12 17:59 bsc.log.2021-03-12_17
-rw-r--r-- 1 bsc bsc 317914 Mar 12 19:00 bsc.log.2021-03-12_18
-rw-r--r-- 1 bsc bsc 318458 Mar 12 20:00 bsc.log.2021-03-12_19
-rw-r--r-- 1 bsc bsc 318739 Mar 12 20:59 bsc.log.2021-03-12_20
-rw-r--r-- 1 bsc bsc 319184 Mar 12 22:00 bsc.log.2021-03-12_21
-rw-r--r-- 1 bsc bsc 318645 Mar 12 23:00 bsc.log.2021-03-12_22
-rw-r--r-- 1 bsc bsc 318582 Mar 13 00:00 bsc.log.2021-03-12_23
-rw-r--r-- 1 bsc bsc 320143 Mar 13 01:00 bsc.log.2021-03-13_00
-rw-r--r-- 1 bsc bsc 319308 Mar 13 02:00 bsc.log.2021-03-13_01
-rw-r--r-- 1 bsc bsc 319031 Mar 13 03:00 bsc.log.2021-03-13_02
-rw-r--r-- 1 bsc bsc 319838 Mar 13 04:00 bsc.log.2021-03-13_03
-rw-r--r-- 1 bsc bsc 318024 Mar 13 05:00 bsc.log.2021-03-13_04
-rw-r--r-- 1 bsc bsc 317292 Mar 13 06:00 bsc.log.2021-03-13_05
-rw-r--r-- 1 bsc bsc 316828 Mar 13 06:59 bsc.log.2021-03-13_06
-rw-r--r-- 1 bsc bsc 319357 Mar 13 08:00 bsc.log.2021-03-13_07
-rw-r--r-- 1 bsc bsc 317396 Mar 13 08:59 bsc.log.2021-03-13_08
-rw-r--r-- 1 bsc bsc 319110 Mar 13 10:00 bsc.log.2021-03-13_09
-rw-r--r-- 1 bsc bsc 320053 Mar 13 11:00 bsc.log.2021-03-13_10
-rw-r--r-- 1 bsc bsc 319043 Mar 13 12:00 bsc.log.2021-03-13_11
-rw-r--r-- 1 bsc bsc 318061 Mar 13 13:00 bsc.log.2021-03-13_12
-rw-r--r-- 1 bsc bsc 319053 Mar 13 14:00 bsc.log.2021-03-13_13
-rw-r--r-- 1 bsc bsc 319549 Mar 13 14:59 bsc.log.2021-03-13_14
-rw-r--r-- 1 bsc bsc 318054 Mar 13 15:59 bsc.log.2021-03-13_15
-rw-r--r-- 1 bsc bsc 319036 Mar 13 16:59 bsc.log.2021-03-13_16
-rw-r--r-- 1 bsc bsc 319549 Mar 13 18:00 bsc.log.2021-03-13_17
-rw-r--r-- 1 bsc bsc 319482 Mar 13 18:59 bsc.log.2021-03-13_18
-rw-r--r-- 1 bsc bsc 317783 Mar 13 20:00 bsc.log.2021-03-13_19
-rw-r--r-- 1 bsc bsc 318536 Mar 13 21:00 bsc.log.2021-03-13_20
-rw-r--r-- 1 bsc bsc 317801 Mar 13 22:00 bsc.log.2021-03-13_21
-rw-r--r-- 1 bsc bsc 319516 Mar 13 23:00 bsc.log.2021-03-13_22
-rw-r--r-- 1 bsc bsc 320276 Mar 14 00:00 bsc.log.2021-03-13_23
-rw-r--r-- 1 bsc bsc 318261 Mar 14 01:00 bsc.log.2021-03-14_00
-rw-r--r-- 1 bsc bsc 316822 Mar 14 02:00 bsc.log.2021-03-14_01
-rw-r--r-- 1 bsc bsc 317278 Mar 14 03:00 bsc.log.2021-03-14_02
-rw-r--r-- 1 bsc bsc 318844 Mar 14 04:00 bsc.log.2021-03-14_03
-rw-r--r-- 1 bsc bsc 318133 Mar 14 05:00 bsc.log.2021-03-14_04
-rw-r--r-- 1 bsc bsc 319919 Mar 14 06:00 bsc.log.2021-03-14_05

It seems there is no option to disable logs rotation by hour in the configuration file.

So would be nice to add an option into the config file to:

  • rotate by size
  • rotate by date (daily, hourly, weekly, monthly, etc)
  • disable rotation altogether

Of course, you could completely disable [Node.LogConfig] section and log into stdout and then handle the logs by yourself, but it's not practical, it will involve more tooling.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions