我有以下配置,
appenders:
- type: file
threshold: INFO
currentLogFilename: /var/log/service/test/test.log
archivedLogFilenamePattern: /var/log/service/test/test-%i.log.gz
archive: true
archivedFileCount: 25
timeZone: IST
maxFileSize: 500MB
logFormat: "%-5level [%date] %X{test-Request-ID} [%thread] [%logger{0}]: %message%n"
- type: console
threshold: INFO
timeZone: IST
logFormat: "%-5level [%date] %X{test-Request-ID} [%thread] [%logger{0}]: %message%n"
我可以在提供的位置看到的日志文件是
drwxrwxrwx 2 cp-transact cp-transact 4.0K Sep 9 13:27 .
drwxr-xr-x 3 9999 9999 4.0K Jul 20 2020 ..
-rw-r--r-- 1 root root 62M Sep 9 13:27 test-1.log.gz
-rw-r--r-- 1 root root 60M Sep 9 06:16 test-10.log.gz
-rw-r--r-- 1 root root 54M Sep 9 03:46 test-11.log.gz
-rw-r--r-- 1 root root 51M Sep 9 02:36 test-12.log.gz
-rw-r--r-- 1 root root 55M Sep 9 02:34 test-13.log.gz
-rw-r--r-- 1 root root 51M Sep 9 02:31 test-14.log.gz
-rw-r--r-- 1 root root 51M Sep 9 02:29 test-15.log.gz
-rw-r--r-- 1 root root 50M Sep 9 02:26 test-16.log.gz
-rw-r--r-- 1 root root 57M Sep 9 02:24 test-17.log.gz
-rw-r--r-- 1 root root 51M Sep 9 02:21 test-18.log.gz
-rw-r--r-- 1 root root 53M Sep 9 02:18 test-19.log.gz
-rw-r--r-- 1 root root 52M Sep 9 12:50 test-2.log.gz
-rw-r--r-- 1 root root 55M Sep 9 02:15 test-20.log.gz
-rw-r--r-- 1 root root 61M Sep 9 01:47 test-21.log.gz
-rw-r--r-- 1 root root 65M Sep 9 12:38 test-3.log.gz
-rw-r--r-- 1 root root 65M Sep 9 11:54 test-4.log.gz
-rw-r--r-- 1 root root 65M Sep 9 11:08 test-5.log.gz
-rw-r--r-- 1 root root 65M Sep 9 10:21 test-6.log.gz
-rw-r--r-- 1 root root 65M Sep 9 09:30 test-7.log.gz
-rw-r--r-- 1 root root 65M Sep 9 08:36 test-8.log.gz
-rw-r--r-- 1 root root 64M Sep 9 07:35 test-9.log.gz
-rw-r--r-- 1 root root 369M Sep 9 14:00 test.log
-rw-r--r-- 1 root root 58M Sep 9 02:21 test_request-1.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 59M Aug 27 00:35 test_request-10.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 75M Aug 26 14:00 test_request-11.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 83M Aug 24 18:18 test_request-12.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 81M Aug 22 12:06 test_request-13.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 81M Aug 20 08:45 test_request-14.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 82M Aug 18 03:55 test_request-15.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 83M Aug 15 22:00 test_request-16.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 83M Aug 13 21:35 test_request-17.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 84M Aug 11 21:13 test_request-18.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 87M Aug 9 21:17 test_request-19.log.gz
-rw-r--r-- 1 root root 71M Sep 8 15:59 test_request-2.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 86M Aug 8 08:21 test_request-20.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 87M Aug 6 13:39 test_request-21.log.gz
-rw-r--r-- 1 root root 82M Sep 7 08:45 test_request-3.log.gz
-rw-r--r-- 1 root root 83M Sep 5 08:58 test_request-4.log.gz
-rw-r--r-- 1 root root 78M Sep 3 08:22 test_request-5.log.gz
-rw-r--r-- 1 root root 73M Sep 1 14:41 test_request-6.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 83M Aug 31 00:06 test_request-7.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 78M Aug 28 21:54 test_request-8.log.gz
-rwxrwxrwx 1 cp-transact cp-transact 51M Aug 27 02:04 test_request-9.log.gz
-rw-r--r-- 1 root root 263M Sep 9 14:00 test_request.log
-rwxrwxrwx 1 cp-transact cp-transact 6.1M Sep 9 13:58 gc.log
-rwxrwxrwx 1 cp-transact cp-transact 11K Aug 31 12:29 service-test.log
-rwxrwxrwx 1 cp-transact cp-transact 28K Aug 31 12:30 sql.log
仅为 21 个文件创建日志文件。
我没有从 logrotate.d 配置文件中看到任何相关信息。
还有什么方法可以控制这些日志?除了配置文件,文件数只有 21 而不是 25 的原因是什么?