質問編集履歴

1

Linuxタグ・/etc/logrotate.conf・デバッグモードでの実行結果の追加

2022/11/11 06:45

投稿

halohalolin
halohalolin

スコア46

test CHANGED
File without changes
test CHANGED
@@ -33,6 +33,33 @@
33
33
  ```
34
34
 
35
35
  ### 該当のソースコード
36
+
37
+ #### /etc/logrotate.conf
38
+
39
+ ```logrotate
40
+ # see "man logrotate" for details
41
+ # rotate log files weekly
42
+ weekly
43
+
44
+ # keep 4 weeks worth of backlogs
45
+ rotate 4
46
+
47
+ # create new (empty) log files after rotating old ones
48
+ create
49
+
50
+ # use date as a suffix of the rotated file
51
+ #dateext
52
+
53
+ # uncomment this if you want your log files compressed
54
+ #compress
55
+
56
+ # packages drop log rotation information into this directory
57
+ include /etc/logrotate.d
58
+
59
+ # system-specific logs may be also be configured here.
60
+ ```
61
+
62
+ #### cat /etc/logrotate.d/apache2
36
63
 
37
64
  ```logrotate
38
65
  /var/log/apache2/*.log {
@@ -57,4 +84,164 @@
57
84
  }
58
85
  ```
59
86
 
87
+ ### デバッグモードでの実行結果
88
+
89
+ ```text
90
+ # logrotate -d /etc/logrotate.conf
91
+ WARNING: logrotate in debug mode does nothing except printing debug messages! Consider using verbose mode (-v) instead if this is not what you want.
92
+
93
+ reading config file /etc/logrotate.conf
94
+ including /etc/logrotate.d
95
+ reading config file alternatives
96
+ reading config file apache2
97
+ reading config file apt
98
+ reading config file btmp
99
+ reading config file dpkg
100
+ reading config file rsyslog
101
+ reading config file wtmp
102
+ Reading state from file: /var/lib/logrotate/status
103
+ Allocating hash table for state file, size 64 entries
104
+
105
+ Handling 9 logs
106
+
107
+ rotating pattern: /var/log/alternatives.log monthly (12 rotations)
108
+ empty log files are not rotated, old logs are removed
109
+ considering log /var/log/alternatives.log
110
+ log /var/log/alternatives.log does not exist -- skipping
111
+ Creating new state
112
+
113
+ rotating pattern: /var/log/apache2/*.log after 1 days (14 rotations)
114
+ empty log files are not rotated, old logs are removed
115
+ considering log /var/log/apache2/access.log
116
+ Creating new state
117
+ Now: 2022-11-11 06:28
118
+ Last rotated at 2022-11-11 06:00
119
+ log does not need rotating (log has been already rotated)
120
+ considering log /var/log/apache2/error.log
121
+ Creating new state
122
+ Now: 2022-11-11 06:28
123
+ Last rotated at 2022-11-11 06:00
124
+ log does not need rotating (log has been already rotated)
125
+ considering log /var/log/apache2/other_vhosts_access.log
126
+ Creating new state
127
+ Now: 2022-11-11 06:28
128
+ Last rotated at 2022-11-11 06:00
129
+ log does not need rotating (log has been already rotated)
130
+ not running prerotate script, since no logs will be rotated
131
+ not running postrotate script, since no logs were rotated
132
+
133
+ rotating pattern: /var/log/apt/term.log monthly (12 rotations)
134
+ empty log files are not rotated, old logs are removed
135
+ considering log /var/log/apt/term.log
136
+ Creating new state
137
+ Now: 2022-11-11 06:28
138
+ Last rotated at 2022-11-11 06:00
139
+ log does not need rotating (log has been already rotated)
140
+
141
+ rotating pattern: /var/log/apt/history.log monthly (12 rotations)
142
+ empty log files are not rotated, old logs are removed
143
+ considering log /var/log/apt/history.log
144
+ Creating new state
145
+ Now: 2022-11-11 06:28
146
+ Last rotated at 2022-11-11 06:00
147
+ log does not need rotating (log has been already rotated)
148
+
149
+ rotating pattern: /var/log/btmp monthly (1 rotations)
150
+ empty log files are rotated, old logs are removed
151
+ considering log /var/log/btmp
152
+ log /var/log/btmp does not exist -- skipping
153
+ Creating new state
154
+
155
+ rotating pattern: /var/log/dpkg.log monthly (12 rotations)
156
+ empty log files are not rotated, old logs are removed
157
+ considering log /var/log/dpkg.log
158
+ Creating new state
159
+ Now: 2022-11-11 06:28
160
+ Last rotated at 2022-11-11 06:00
161
+ log does not need rotating (log has been already rotated)
162
+
163
+ rotating pattern: /var/log/syslog
164
+ after 1 days (7 rotations)
165
+ empty log files are not rotated, old logs are removed
166
+ considering log /var/log/syslog
167
+ Creating new state
168
+ Now: 2022-11-11 06:28
169
+ Last rotated at 2022-11-11 06:00
170
+ log does not need rotating (log has been already rotated)
171
+
172
+ rotating pattern: /var/log/mail.info
173
+ /var/log/mail.warn
174
+ /var/log/mail.err
175
+ /var/log/mail.log
176
+ /var/log/daemon.log
177
+ /var/log/kern.log
178
+ /var/log/auth.log
179
+ /var/log/user.log
180
+ /var/log/lpr.log
181
+ /var/log/cron.log
182
+ /var/log/debug
183
+ /var/log/messages
184
+ weekly (4 rotations)
185
+ empty log files are not rotated, old logs are removed
186
+ considering log /var/log/mail.info
187
+ Creating new state
188
+ Now: 2022-11-11 06:28
189
+ Last rotated at 2022-11-11 06:00
190
+ log does not need rotating (log has been already rotated)
191
+ considering log /var/log/mail.warn
192
+ Creating new state
193
+ Now: 2022-11-11 06:28
194
+ Last rotated at 2022-11-11 06:00
195
+ log does not need rotating (log has been already rotated)
196
+ considering log /var/log/mail.err
197
+ Creating new state
198
+ Now: 2022-11-11 06:28
199
+ Last rotated at 2022-11-11 06:00
200
+ log does not need rotating (log has been already rotated)
201
+ considering log /var/log/mail.log
202
+ Creating new state
203
+ Now: 2022-11-11 06:28
204
+ Last rotated at 2022-11-11 06:00
205
+ log does not need rotating (log has been already rotated)
206
+ considering log /var/log/daemon.log
207
+ log /var/log/daemon.log does not exist -- skipping
208
+ Creating new state
209
+ considering log /var/log/kern.log
210
+ log /var/log/kern.log does not exist -- skipping
211
+ Creating new state
212
+ considering log /var/log/auth.log
213
+ Creating new state
214
+ Now: 2022-11-11 06:28
215
+ Last rotated at 2022-11-11 06:00
216
+ log does not need rotating (log has been already rotated)
217
+ considering log /var/log/user.log
218
+ Creating new state
219
+ Now: 2022-11-11 06:28
220
+ Last rotated at 2022-11-11 06:00
221
+ log does not need rotating (log has been already rotated)
222
+ considering log /var/log/lpr.log
223
+ log /var/log/lpr.log does not exist -- skipping
224
+ Creating new state
225
+ considering log /var/log/cron.log
226
+ log /var/log/cron.log does not exist -- skipping
227
+ Creating new state
228
+ considering log /var/log/debug
229
+ log /var/log/debug does not exist -- skipping
230
+ Creating new state
231
+ considering log /var/log/messages
232
+ Creating new state
233
+ Now: 2022-11-11 06:28
234
+ Last rotated at 2022-11-11 06:00
235
+ log does not need rotating (log has been already rotated)
236
+ not running postrotate script, since no logs were rotated
237
+
238
+ rotating pattern: /var/log/wtmp monthly (1 rotations)
239
+ empty log files are rotated, only log files >= 1048576 bytes are rotated, old logs are removed
240
+ considering log /var/log/wtmp
241
+ log /var/log/wtmp does not exist -- skipping
242
+ Creating new state
243
+ ```
244
+
245
+ ※/var/lib/logrotate/logrotate.status も調べようとしましたが、/var/lib/logrotate内が空フォルダだったので、他の場所に格納していないか調査中です
246
+
60
247
  以上よろしくお願いいたします。