增量备份中的奇怪日志行为

增量备份中的奇怪日志行为

有一段时间,我观察到增量备份中的日志记录行为有些奇怪。例如,以过去七天为例:

RychuSrvSystemBackup_2019-03-14_060001.tar.gz     570.26 MB     2019-03-14 06:00:08
RychuSrvSystemBackup_2019-03-15_060001.tar.gz     63.37 MB      2019-03-15 06:00:08
RychuSrvSystemBackup_2019-03-16_060001.tar.gz     572.26 MB     2019-03-16 06:00:08
RychuSrvSystemBackup_2019-03-17_060001.tar.gz     56.74 MB      2019-03-17 06:00:08
RychuSrvSystemBackup_2019-03-18_060002.tar.gz     575.14 MB     2019-03-18 06:00:08
RychuSrvSystemBackup_2019-03-19_060001.tar.gz     57.26 MB      2019-03-19 06:00:08
RychuSrvSystemBackup_2019-03-20_060001.tar.gz     577.64 MB     2019-03-20 06:00:08

正如您所见,模式清晰可见。每秒的增量备份都比上一次大 10 倍。

较大的那几本内容大部分被期刊占据: 日志文件占备份的 92%

但是如果我运行sudo journalctl -b 0查看当前启动的日志,它并不长。肯定不会长达 4GB。下面你可以看到当前日志的 10 天包含 2 448 552 个字符,并且不同天数差别不大:

rychu@RychuSRV:~$ date
Wed Mar 20 21:41:59 CET 2019
rychu@RychuSRV:~$ uptime
 21:42:03 up 10 days, 23 min,  1 user,  load average: 0.06, 0.03, 0.00
rychu@RychuSRV:~$ sudo journalctl -b 0 --all | wc
  23754  303844 2448552
rychu@RychuSRV:~$ sudo journalctl -b 0 --since "2019-03-15" --until "2019-03-16" | wc --bytes
227629
rychu@RychuSRV:~$ sudo journalctl -b 0 --since "2019-03-16" --until "2019-03-17" | wc --bytes
225997
rychu@RychuSRV:~$ sudo journalctl -b 0 --since "2019-03-17" --until "2019-03-18" | wc --bytes
219993
rychu@RychuSRV:~$ sudo journalctl -b 0 --since "2019-03-18" --until "2019-03-19" | wc --bytes
218366

谁能告诉我我在看什么吗?

答案1

我打开其中一个备份文件并对其进行了调查。日志文件包含 10 月份的日志。因此,我转到我的日志文件夹以检查那里发生了什么。出于某种原因,它包含了很多旧文件。

rychu@RychuSRV:/var/log/journal/49c3cfc239cf43ba92e578f070ce35cb$ ls -1lt
total 936272
-rw-r-----+ 1 root systemd-journal   8388608 Mar 26 21:40 system.journal
-rw-r-----+ 1 root systemd-journal   8388608 Mar 26 21:40 user-1000.journal
-rw-r-----+ 1 root systemd-journal  25165824 Mar 26 21:40 system@6b32fcbe244e46c8a49b4a12b888f330-0000000000467dd7-0005849ff9c719fc.journal
-rw-r-----+ 1 root systemd-journal   8388608 Mar 26 21:40 user-1000@85073486393d48dfa71d4b44fc06a986-000000000045b25d-000583bb822d1769.journal
-rw-r-----+ 1 root systemd-journal  50331648 Mar 21 20:45 system@6b32fcbe244e46c8a49b4a12b888f330-000000000045c780-000583bcf695c289.journal
-rw-r-----+ 1 root systemd-journal   8388608 Mar 10 13:54 system@6b32fcbe244e46c8a49b4a12b888f330-000000000045b268-000583bb822eeba9.journal
-rw-r-----+ 1 root systemd-journal   8388608 Mar 10 12:10 system@6b32fcbe244e46c8a49b4a12b888f330-000000000045a9b8-000583a964b2114a.journal
-rw-r-----+ 1 root systemd-journal   8388608 Mar 10 12:10 user-1000@85073486393d48dfa71d4b44fc06a986-000000000042a1b5-000581542ff460ad.journal
-rw-r-----+ 1 root systemd-journal  92274688 Mar  9 14:34 system@6b32fcbe244e46c8a49b4a12b888f330-000000000043b7f4-0005821a2d1d6896.journal
-rw-r-----+ 1 root systemd-journal  25165824 Feb 17 18:17 system@6b32fcbe244e46c8a49b4a12b888f330-0000000000434fd1-00058209bff09636.journal
-rw-r-----+ 1 root systemd-journal  33554432 Feb 16 22:41 system@6b32fcbe244e46c8a49b4a12b888f330-000000000042a1c0-000581542ff60fa7.journal
-rw-r-----+ 1 root systemd-journal  75497472 Feb  7 22:04 system@6b32fcbe244e46c8a49b4a12b888f330-000000000041291d-0005805bb9b54dde.journal
-rw-r-----+ 1 root systemd-journal   8388608 Feb  5 22:51 user-1000@85073486393d48dfa71d4b44fc06a986-00000000003f2803-00057ecaa2138ad0.journal
-rw-r-----+ 1 root systemd-journal  92274688 Jan 26 13:38 system@6b32fcbe244e46c8a49b4a12b888f330-00000000003f280e-00057ecaa21549c9.journal
-rw-r-----+ 1 root systemd-journal  75497472 Jan  6 15:07 system@6b32fcbe244e46c8a49b4a12b888f330-00000000003d78ea-00057d741dcd13d8.journal
-rw-r-----+ 1 root systemd-journal   8388608 Dec 30 16:44 user-1000@85073486393d48dfa71d4b44fc06a986-00000000003b607b-00057c0971f6aa02.journal
-rw-r-----+ 1 root systemd-journal  92274688 Dec 20 14:29 system@6b32fcbe244e46c8a49b4a12b888f330-00000000003b6772-00057c097595426a.journal
-rw-r-----+ 1 root systemd-journal   8388608 Dec  2 13:49 system@6b32fcbe244e46c8a49b4a12b888f330-00000000003b6022-00057c0971f2ac17.journal
-rw-r-----+ 1 root systemd-journal 100663296 Dec  2 13:48 system@6b32fcbe244e46c8a49b4a12b888f330-0000000000000001-00057a75254c56a7.journal
-rw-r-----+ 1 root systemd-journal   8388608 Dec  2 13:22 user-1000@85073486393d48dfa71d4b44fc06a986-00000000003b04c0-00057bd1e273d8d8.journal
-rw-r-----+ 1 root systemd-journal   8388608 Nov 12 11:27 [email protected]~
-rw-r-----+ 1 root systemd-journal 109051904 Nov 11 09:59 system@0a34594fa6cf47028146717661072913-0000000000391369-0005798636e53ebc.journal
-rw-r-----+ 1 root systemd-journal   8388608 Nov  8 08:08 user-1000@85073486393d48dfa71d4b44fc06a986-00000000003a2031-00057986ae4b8fe1.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:23 system@0a34594fa6cf47028146717661072913-0000000000369dcc-00057986363f6125.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:23 system@0a34594fa6cf47028146717661072913-0000000000342299-00057986356c935d.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:23 system@0a34594fa6cf47028146717661072913-000000000031bce4-0005798634c62dfd.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:23 system@0a34594fa6cf47028146717661072913-00000000002f49dd-00057986341380c5.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:23 system@0a34594fa6cf47028146717661072913-00000000002cd580-000579863361e27a.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:22 system@0a34594fa6cf47028146717661072913-00000000002a5f66-0005798632b3049d.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:22 system@0a34594fa6cf47028146717661072913-000000000027ec56-000579863207f641.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:22 system@0a34594fa6cf47028146717661072913-000000000025752d-000579863166eb35.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:22 system@0a34594fa6cf47028146717661072913-000000000022fcf1-0005798630c4b710.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:22 system@0a34594fa6cf47028146717661072913-0000000000208466-00057986301980e0.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:22 system@0a34594fa6cf47028146717661072913-00000000001e0e79-000579862f79aa69.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:21 system@0a34594fa6cf47028146717661072913-00000000001b89de-000579862ebbe63a.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:21 system@0a34594fa6cf47028146717661072913-00000000001919f1-000579862dea0fea.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:21 system@0a34594fa6cf47028146717661072913-000000000016a2f2-000579862d1dc5b1.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:21 system@0a34594fa6cf47028146717661072913-0000000000142758-000579862c3b1988.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:20 system@0a34594fa6cf47028146717661072913-000000000011b41e-000579862b4cfb05.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:20 system@0a34594fa6cf47028146717661072913-00000000000f3947-000579862a623523.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:20 system@0a34594fa6cf47028146717661072913-00000000000cc4af-00057986294bd0b0.journal
-rw-r-----+ 1 root systemd-journal 134217728 Oct 31 14:20 system@0a34594fa6cf47028146717661072913-00000000000a5ec6-000579727fa017a2.journal
-rw-r-----+ 1 root systemd-journal   8388608 Oct 31 14:01 user-1000@85073486393d48dfa71d4b44fc06a986-0000000000087eba-00057834554d497e.journal
-rw-r-----+ 1 root systemd-journal  67108864 Oct 30 14:52 system@0a34594fa6cf47028146717661072913-000000000008fbb4-0005786de88cc8e4.journal
-rw-r-----+ 1 root systemd-journal  33554432 Oct 17 16:58 system@0a34594fa6cf47028146717661072913-0000000000087ec5-00057834554ec4d2.journal
-rw-r-----+ 1 root systemd-journal  75497472 Oct 14 20:17 system@0a34594fa6cf47028146717661072913-000000000006e799-000576eb9431c0e4.journal
-rw-r-----+ 1 root systemd-journal   8388608 Sep 30 14:32 user-1000@85073486393d48dfa71d4b44fc06a986-0000000000067f69-00057586adfd2a7b.journal
-rw-r-----+ 1 root systemd-journal  50331648 Sep 28 12:04 system@0a34594fa6cf47028146717661072913-000000000005c240-000574e7d0ff8277.journal
-rw-r-----+ 1 root systemd-journal 100663296 Sep  2  2018 system@0a34594fa6cf47028146717661072913-0000000000036449-000573a34107c409.journal
-rw-r-----+ 1 root systemd-journal   8388608 Aug 30  2018 user-1000@85073486393d48dfa71d4b44fc06a986-000000000003643a-000573a341065e3c.journal
-rw-r-----+ 1 root systemd-journal  25165824 Aug 17  2018 system@0a34594fa6cf47028146717661072913-000000000002ebe9-0005732644727647.journal
-rw-r-----+ 1 root systemd-journal   8388608 Aug 16  2018 user-1000@85073486393d48dfa71d4b44fc06a986-000000000001db6f-00057134e41e02a8.journal
-rw-r-----+ 1 root systemd-journal   8388608 Aug 11  2018 system@0a34594fa6cf47028146717661072913-000000000002e46f-00057326338a8233.journal
-rw-r-----+ 1 root systemd-journal   8388608 Aug 11  2018 system@0a34594fa6cf47028146717661072913-000000000002d8c2-0005728409020411.journal
-rw-r-----+ 1 root systemd-journal  25165824 Aug  3  2018 system@0a34594fa6cf47028146717661072913-0000000000027e27-000571eb4585d762.journal
-rw-r-----+ 1 root systemd-journal   8388608 Jul 26  2018 system@0a34594fa6cf47028146717661072913-0000000000027658-000571adbec89b2f.journal
-rw-r-----+ 1 root systemd-journal  16777216 Jul 23  2018 system@0a34594fa6cf47028146717661072913-00000000000242d4-0005715f22ee8579.journal
-rw-r-----+ 1 root systemd-journal  25165824 Jul 19  2018 system@0a34594fa6cf47028146717661072913-000000000001db7e-00057134e41f6c6c.journal
-rw-r-----+ 1 root systemd-journal   8388608 Jul 17  2018 system@0a34594fa6cf47028146717661072913-000000000001daf6-00057134b772aff4.journal
-rw-r-----+ 1 root systemd-journal   8388608 Jul 17  2018 user-1000@85073486393d48dfa71d4b44fc06a986-0000000000001d22-00056ec1cd44e38d.journal
-rw-r-----+ 1 root systemd-journal  16777216 Jul 17  2018 system@0a34594fa6cf47028146717661072913-00000000000199ff-0005706479e88b1a.journal
-rw-r-----+ 1 root systemd-journal   8388608 Jul  7  2018 system@0a34594fa6cf47028146717661072913-00000000000192db-00057032808fb00a.journal
-rw-r-----+ 1 root systemd-journal   8388608 Jul  4  2018 system@0a34594fa6cf47028146717661072913-000000000001881f-00057032038d82b4.journal
-rw-r-----+ 1 root systemd-journal   8388608 Jul  4  2018 system@0a34594fa6cf47028146717661072913-000000000001818a-000570316124cd44.journal
-rw-r-----+ 1 root systemd-journal   8388608 Jul  4  2018 system@0a34594fa6cf47028146717661072913-0000000000017c40-0005700a4b518857.journal
-rw-r-----+ 1 root systemd-journal  25165824 Jul  2  2018 system@0a34594fa6cf47028146717661072913-000000000001107a-00056fb4f9f4a1fb.journal
-rw-r-----+ 1 root systemd-journal  16777216 Jun 28  2018 system@0a34594fa6cf47028146717661072913-000000000000e552-00056fb115f8a63a.journal
-rw-r-----+ 1 root systemd-journal  16777216 Jun 28  2018 system@0a34594fa6cf47028146717661072913-000000000000baf5-00056f7ddd5bc201.journal
-rw-r-----+ 1 root systemd-journal   8388608 Jun 25  2018 system@0a34594fa6cf47028146717661072913-000000000000ab93-00056f7cc22f704d.journal
-rw-r-----+ 1 root systemd-journal  16777216 Jun 25  2018 system@0a34594fa6cf47028146717661072913-0000000000007db7-00056f2b405ada63.journal
-rw-r-----+ 1 root systemd-journal  16777216 Jun 21  2018 system@0a34594fa6cf47028146717661072913-0000000000004bc1-00056eefbd243da3.journal
-rw-r-----+ 1 root systemd-journal  16777216 Jun 18  2018 system@0a34594fa6cf47028146717661072913-0000000000000001-00056ebf5f41359d.journal

我使用以下方法清除了这些文件

rychu@RychuSRV:/var/log/journal/49c3cfc239cf43ba92e578f070ce35cb$ sudo journalctl --vacuum-time=1m

所以只剩下最新的文件

rychu@RychuSRV:/var/log/journal/49c3cfc239cf43ba92e578f070ce35cb$ ls -1lt
total 149
-rw-r-----+ 1 root systemd-journal 8388608 Mar 26 21:42 system.journal
-rw-r-----+ 1 root systemd-journal 8388608 Mar 26 21:40 user-1000.journal

不幸的是,我无法解释为什么tar看到这些文件被触碰并将它们包含在备份中,也无法解释为什么它们没有被清除,logrotate但从那时起,奇怪的行为就消失了,我所有的增量备份又变小了!:)

相关内容