Gentoo Archives: gentoo-user

From: Alexander Kapshuk <alexander.kapshuk@×××××.com>
To: Gentoo mailing list <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] portage summary logs not rotated any more
Date: Sun, 05 Apr 2015 15:31:51
Message-Id: CAJ1xhMWdENAg5V8Y2T+LoX91Ctozsh3Fexb-PGT2DAdz0KaQxw@mail.gmail.com
In Reply to: Re: [gentoo-user] portage summary logs not rotated any more by Mick
1 On Sun, Apr 5, 2015 at 5:36 PM, Mick <michaelkintzios@×××××.com> wrote:
2
3 > On Sunday 05 Apr 2015 14:19:16 Alexander Kapshuk wrote:
4 > > On Sun, Apr 5, 2015 at 10:50 AM, Mick <michaelkintzios@×××××.com> wrote:
5 > > > On Sunday 05 Apr 2015 06:39:31 Alexander Kapshuk wrote:
6 > > > > On Sun, Apr 5, 2015 at 1:18 AM, Mick <michaelkintzios@×××××.com>
7 > wrote:
8 > > > > > On Saturday 04 Apr 2015 20:35:31 Alexander Kapshuk wrote:
9 > > > > > > My portage summary logs don't seem to be rotated any more.
10 > > > > > >
11 > > > > > > ls -lt `pwd`/summary.log*
12 > > > > > > -rw-rw-r-- 1 portage portage 96581 Apr 3 19:47
13 > > > > > > /var/log/portage/elog/summary.log
14 > > > > > > -rw-rw-r-- 1 portage portage 5927 Jan 10 07:50
15 > > > > > > /var/log/portage/elog/summary.log-20150112
16 > > > > > > -rw-rw-r-- 1 portage portage 2281 Jan 4 21:14
17 > > > > > > /var/log/portage/elog/summary.log-20150104.gz
18 > > > > > > -rw-rw-r-- 1 portage portage 565 Dec 26 20:53
19 > > > > > > /var/log/portage/elog/summary.log-20141228.gz
20 > > > > > > -rw-rw-r-- 1 portage portage 1842 Dec 22 17:52
21 > > > > > > /var/log/portage/elog/summary.log-20141222.gz
22 > > > > > >
23 > > > > > > grep Messages summary.log | sed '1h;$!d;x;G;q'
24 > > > > > >
25 > > > > > > >>> Messages generated by process 3399 on 2015-01-13 17:47:47 EET
26 > > > > > > >>> for
27 > > > > > >
28 > > > > > > package dev-python/reportlab-3.1.8-r2:
29 > > > > > > >>> Messages generated by process 4080 on 2015-04-03 19:47:54
30 > EEST
31 > > >
32 > > > for
33 > > >
34 > > > > > > package net-print/hplip-3.14.1:
35 > > > > > >
36 > > > > > > grep Messages summary.log-20150112 | sed '1h;$!d;x;G;q'
37 > > > > > >
38 > > > > > > >>> Messages generated by process 2637 on 2015-01-04 22:02:00 EET
39 > > > > > > >>> for
40 > > > > > >
41 > > > > > > package app-office/libreoffice-4.2.8.2:
42 > > > > > > >>> Messages generated by process 3483 on 2015-01-10 07:50:04 EET
43 > > > > > > >>> for
44 > > > > > >
45 > > > > > > package dev-libs/openssl-1.0.1k:
46 > > > > > >
47 > > > > > > cat /etc/logrotate.d/elog-save-summary
48 > > > > > > # Copyright 1999-2011 Gentoo Foundation
49 > > > > > > # Distributed under the terms of the GNU General Public License
50 > v2
51 > > > > > > # Rotate the log created by the save_summary elog module.
52 > > > > > >
53 > > > > > > /var/log/portage/elog/summary.log {
54 > > > > > >
55 > > > > > > su portage portage
56 > > > > > > missingok
57 > > > > > > nocreate
58 > > > > > > delaycompress
59 > > > > > >
60 > > > > > > }
61 > > > > > >
62 > > > > > > /etc/logrotate.conf:6,8
63 > > > > > > # rotate log files weekly.
64 > > > > > > weekly
65 > > > > > > #daily
66 > > > > > >
67 > > > > > > What could be wrong here? Or am I misreading something?
68 > > > > > >
69 > > > > > > Thanks.
70 > > > > >
71 > > > > > Is your logrotate running regularly as expected? What do you get
72 > > > > > when
73 > > > > >
74 > > > > > from:
75 > > > > > grep logrotate /var/log/cron.log
76 > > > > >
77 > > > > > --
78 > > > > > Regards,
79 > > > > > Mick
80 > > > >
81 > > > > Thanks for your response.
82 > > > >
83 > > > > I'm afraid I don't have the cron logging set up. I should probably go
84 > > >
85 > > > ahead
86 > > >
87 > > > > and do it, shouldn't I?
88 > > > >
89 > > > > grep logrotate /var/log/cron.log
90 > > > > grep: /var/log/cron.log: No such file or directory
91 > > > >
92 > > > > The cron daemon is running though.
93 > > > >
94 > > > > ps auxwww|grep '[c]ron'
95 > > > > root 2418 0.0 0.1 5464 1868 ? Ss 08:33 0:00
96 > > > > /usr/sbin/crond
97 > > > >
98 > > > > Thanks.
99 > > >
100 > > > Ah! I must have set this up myself. In /etc/syslog-ng/syslog-ng.conf I
101 > > > have
102 > > > among other settings:
103 > > >
104 > > > destination cron { file("/var/log/cron.log"); };
105 > > > filter f_cron { facility(cron); };
106 > > > log { source(src); filter(f_cron); destination(cron); };
107 > > >
108 > > > This is not necessary though. You can search /var/log/messages for
109 > > > logrotate.
110 > > >
111 > > > --
112 > > > Regards,
113 > > > Mick
114 > >
115 > > Understood. Thanks.
116 > >
117 > > Messages doesn't seem to have anything out of the ordinary to say about
118 > > logrotate though.
119 > > sed '/logrotate/!d' /var/log/messages
120 > > Jan 13 17:50:02 localhost run-crons[7443]: (root) CMD
121 > > (/etc/cron.daily/logrotate)
122 > > Jan 14 18:00:02 localhost run-crons[4576]: (root) CMD
123 > > (/etc/cron.daily/logrotate)
124 > > Jan 15 18:10:02 localhost run-crons[1692]: (root) CMD
125 > > (/etc/cron.daily/logrotate)
126 > > Jan 16 18:20:01 localhost run-crons[4448]: (root) CMD
127 > > (/etc/cron.daily/logrotate)
128 > >
129 > > An observation I've made, is that my log rotation seems to have effected
130 > > all other logs in /var/log as well. It seems to have stopped working
131 > around
132 > > January this year.
133 > >
134 > > ls -lt /var/log/messages*
135 > > -rw------- 1 root root 9986127 Apr 5 16:10 /var/log/messages
136 > > -rw------- 1 root root 173843 Jan 12 10:20 /var/log/messages-20150112.gz
137 > > -rw------- 1 root root 277867 Jan 4 22:00 /var/log/messages-20150104.gz
138 > > -rw------- 1 root root 132157 Dec 28 20:30 /var/log/messages-20141228.gz
139 > > -rw------- 1 root root 142911 Dec 22 19:30 /var/log/messages-20141222.gz
140 > >
141 > > sed '1h;$!d;x;G;q' /var/log/messages
142 > > Jan 12 10:20:02 localhost syslog-ng[2321]: Configuration reload request
143 > > received, reloading configuration;
144 > > Apr 5 16:10:01 box1 CROND[2265]: pam_unix(crond:session): session closed
145 > > for user root
146 > >
147 > > ls -lt /var/log/|sort -k9
148 > > total 16064
149 > > drwxr-xr-x 2 root root 4096 Feb 15 00:42 ConsoleKit
150 > > -rw-r--r-- 1 root sasha 33914 Apr 5 08:34 Xorg.0.log
151 > > -rw-r--r-- 1 root sasha 34515 Apr 4 23:17 Xorg.0.log.old
152 > > -rw-r--r-- 1 root sasha 28290 Sep 22 2014 Xorg.1.log
153 > > drwxr-xr-x 2 root root 4096 Jan 12 10:20 chrony
154 > > drwxr-xr-x 2 root root 4096 Feb 7 12:26 cups
155 > > -rw-r----- 1 root root 50378 Apr 5 08:33 dmesg
156 > > -rw-rw---- 1 portage portage 6268 Apr 1 19:35 emerge-fetch.log
157 > > -rw-rw---- 1 portage portage 2687784 Apr 5 09:04 emerge.log
158 > > -rw-r--r-- 1 root root 292292 Apr 5 08:34 lastlog
159 > > -rw------- 1 root root 9986127 Apr 5 16:10 messages
160 > > -rw------- 1 root root 142911 Dec 22 19:30 messages-20141222.gz
161 > > -rw------- 1 root root 132157 Dec 28 20:30 messages-20141228.gz
162 > > -rw------- 1 root root 277867 Jan 4 22:00 messages-20150104.gz
163 > > -rw------- 1 root root 173843 Jan 12 10:20 messages-20150112.gz
164 > > drwxr-xr-x 2 root root 4096 Dec 22 2013 openconnect
165 > > -rw-r--r-- 1 root root 188788 Apr 5 08:34 pm-powersave.log
166 > > -rw-r--r-- 1 root root 4837 Sep 30 2014
167 > > pm-powersave.log-20141001.gz
168 > > -rw-r--r-- 1 root root 785 Oct 31 07:35
169 > > pm-powersave.log-20141101.gz
170 > > -rw-r--r-- 1 root root 848 Dec 1 17:00
171 > > pm-powersave.log-20141201.gz
172 > > -rw-r--r-- 1 root root 67852 Jan 1 18:34
173 > pm-powersave.log-20150101
174 > > drwxrwsr-x 3 portage portage 4096 Oct 29 2013 portage
175 > > -rw-r--r-- 1 root root 660096 Apr 5 08:33 rc.log
176 > > -rw-r--r-- 1 root root 2705 Dec 22 17:37 rc.log-20141222.gz
177 > > -rw-r--r-- 1 root root 2493 Dec 28 08:33 rc.log-20141228.gz
178 > > -rw-r--r-- 1 root root 4003 Jan 4 19:51 rc.log-20150104.gz
179 > > -rw-r--r-- 1 root root 3026 Jan 12 08:57 rc.log-20150112.gz
180 > > drwxrwx--- 2 root portage 4096 Oct 29 2013 sandbox
181 > > -rw------- 1 root root 64064 Apr 5 08:34 tallylog
182 > > -rw-rw-r-- 1 root utmp 1792896 Apr 5 10:30 wtmp
183 > > -rw-rw-r-- 1 root utmp 32029 Dec 25 17:04 wtmp-20141225.gz
184 > >
185 > > Any input on how to fix this would be much appreciated.
186 >
187 > It seems to me that logrotate stopped rotating your logs back in Jan. Did
188 > you
189 > change something in its configuration back then?
190 >
191 > This is what I have in /etc/cron.daily/logrotate:
192 > ================================================
193 > #!/bin/sh
194 >
195 > /usr/sbin/logrotate /etc/logrotate.conf
196 > EXITVALUE=$?
197 > if [ $EXITVALUE != 0 ]; then
198 > /usr/bin/logger -t logrotate "ALERT exited abnormally with
199 > [$EXITVALUE]"
200 > fi
201 > exit 0
202 > =================================================
203 >
204 >
205 > PS. I leave previous message content untrimmed in case someone else spots
206 > something of significance on what you have posted to date and can chime in
207 > with a solution.
208 >
209 > --
210 > Regards,
211 > Mick
212 >
213
214 The contents of my logrotate cron job file seems to be the same as yours.
215
216 cat /etc/cron.daily/logrotate
217 #!/bin/sh
218
219 /usr/sbin/logrotate /etc/logrotate.conf
220 EXITVALUE=$?
221 if [ $EXITVALUE != 0 ]; then
222 /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
223 fi
224 exit 0
225
226 On further troubleshooting, I found that running logrotate in debugging
227 mode did not reveal anything amiss with the logrotate configuration as far
228 as I could tell.
229
230 /usr/sbin/logrotate -dv /etc/logrotate.conf
231 reading config file /etc/logrotate.conf
232 including /etc/logrotate.d
233 reading config file chrony
234 reading config file consolekit
235 reading config file elog-save-summary
236 reading config file openconnect
237 reading config file openrc
238 reading config file pm-utils
239 reading config file rsyncd
240 reading config file syslog-ng
241
242 Handling 10 logs
243
244 rotating pattern: /var/log/chrony/*.log weekly (4 rotations)
245 empty log files are not rotated, old logs are removed
246 considering log /var/log/chrony/measurements.log
247 log needs rotating
248 considering log /var/log/chrony/statistics.log
249 log needs rotating
250 considering log /var/log/chrony/tracking.log
251 log needs rotating
252 rotating log /var/log/chrony/measurements.log, log->rotateCount is 4
253 dateext suffix '-20150405'
254 glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
255 rotating log /var/log/chrony/statistics.log, log->rotateCount is 4
256 dateext suffix '-20150405'
257 glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
258 rotating log /var/log/chrony/tracking.log, log->rotateCount is 4
259 dateext suffix '-20150405'
260 glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
261 renaming /var/log/chrony/measurements.log to
262 /var/log/chrony/measurements.log-20150405
263 creating new /var/log/chrony/measurements.log mode = 0644 uid = 0 gid = 0
264 renaming /var/log/chrony/statistics.log to
265 /var/log/chrony/statistics.log-20150405
266 creating new /var/log/chrony/statistics.log mode = 0644 uid = 0 gid = 0
267 renaming /var/log/chrony/tracking.log to
268 /var/log/chrony/tracking.log-20150405
269 creating new /var/log/chrony/tracking.log mode = 0644 uid = 0 gid = 0
270 running postrotate script
271 running script with arg /var/log/chrony/*.log : "
272 PASSWORD=`awk '$1 ~ /^1$/ {print $2; exit}'
273 /etc/chrony/chrony.keys`
274 cat << EOF | /usr/bin/chronyc | sed '/^200 OK$/d'
275 password $PASSWORD
276 cyclelogs
277 EOF
278 "
279 compressing log with: /bin/gzip
280 removing old log /var/log/chrony/measurements.log-20141222.gz
281 compressing log with: /bin/gzip
282 removing old log /var/log/chrony/statistics.log-20141222.gz
283 compressing log with: /bin/gzip
284 removing old log /var/log/chrony/tracking.log-20141222.gz
285
286 rotating pattern: /var/log/ConsoleKit/history monthly (6 rotations)
287 empty log files are not rotated, old logs are removed
288 considering log /var/log/ConsoleKit/history
289 log does not need rotating
290
291 rotating pattern: /var/log/portage/elog/summary.log weekly (4 rotations)
292 empty log files are not rotated, old logs are removed
293 switching euid to 250 and egid to 250
294 considering log /var/log/portage/elog/summary.log
295 log needs rotating
296 rotating log /var/log/portage/elog/summary.log, log->rotateCount is 4
297 dateext suffix '-20150405'
298 glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
299 compressing log with: /bin/gzip
300 renaming /var/log/portage/elog/summary.log to
301 /var/log/portage/elog/summary.log-20150405
302 switching euid to 0 and egid to 0
303
304 rotating pattern: /var/log/openconnect/*/* 5242880 bytes (4 rotations)
305 empty log files are not rotated, old logs are removed
306 considering log /var/log/openconnect/*/*
307
308 rotating pattern: /var/log/rc.log weekly (4 rotations)
309 empty log files are not rotated, old logs are removed
310 considering log /var/log/rc.log
311 log needs rotating
312 rotating log /var/log/rc.log, log->rotateCount is 4
313 dateext suffix '-20150405'
314 glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
315 renaming /var/log/rc.log to /var/log/rc.log-20150405
316 creating new /var/log/rc.log mode = 0644 uid = 0 gid = 0
317 compressing log with: /bin/gzip
318 removing old log /var/log/rc.log-20141222.gz
319
320 rotating pattern: /var/log/pm-suspend.log /var/log/pm-powersave.log
321 monthly (4 rotations)
322 empty log files are not rotated, old logs are removed
323 considering log /var/log/pm-suspend.log
324 log /var/log/pm-suspend.log does not exist -- skipping
325 considering log /var/log/pm-powersave.log
326 log needs rotating
327 rotating log /var/log/pm-powersave.log, log->rotateCount is 4
328 dateext suffix '-20150405'
329 glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
330 compressing log with: /bin/gzip
331 renaming /var/log/pm-powersave.log to /var/log/pm-powersave.log-20150405
332 creating new /var/log/pm-powersave.log mode = 0644 uid = 0 gid = 0
333
334 rotating pattern: /var/log/rsync.log 1048576 bytes (7 rotations)
335 empty log files are not rotated, old logs are removed
336 considering log /var/log/rsync.log
337 log /var/log/rsync.log does not exist -- skipping
338
339 rotating pattern: /var/log/messages weekly (4 rotations)
340 empty log files are not rotated, old logs are removed
341 considering log /var/log/messages
342 log needs rotating
343 rotating log /var/log/messages, log->rotateCount is 4
344 dateext suffix '-20150405'
345 glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
346 renaming /var/log/messages to /var/log/messages-20150405
347 creating new /var/log/messages mode = 0600 uid = 0 gid = 0
348 running postrotate script
349 running script with arg /var/log/messages : "
350 /etc/init.d/syslog-ng reload > /dev/null 2>&1 || true
351 "
352 compressing log with: /bin/gzip
353 removing old log /var/log/messages-20141222.gz
354
355 rotating pattern: /var/log/wtmp monthly (1 rotations)
356 empty log files are not rotated, only log files >= 1048576 bytes are
357 rotated, old logs are removed
358 considering log /var/log/wtmp
359 log needs rotating
360 rotating log /var/log/wtmp, log->rotateCount is 1
361 dateext suffix '-20150405'
362 glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
363 renaming /var/log/wtmp to /var/log/wtmp-20150405
364 creating new /var/log/wtmp mode = 0664 uid = 0 gid = 406
365 compressing log with: /bin/gzip
366 removing old log /var/log/wtmp-20141225.gz
367
368 rotating pattern: /var/log/btmp monthly (1 rotations)
369 empty log files are not rotated, old logs are removed
370 considering log /var/log/btmp
371 log /var/log/btmp does not exist -- skipping
372
373 I then went ahead and ran logrotate by hand, which resulted in the
374 following output:
375
376 /usr/sbin/logrotate /etc/logrotate.conf
377 501 Not authorised --- Reply not authenticated
378 501 Not authorised --- Reply not authenticated
379 # echo $?
380 0
381
382 As a result, log-rotation did work:
383
384 ls -lt /var/log/*{log,[0-9],gz} /var/log/portage/elog/summary.log* | sort
385 -k9
386 -rw-r--r-- 1 root sasha 33914 Apr 5 08:34 /var/log/Xorg.0.log
387 -rw-r--r-- 1 root sasha 28290 Sep 22 2014 /var/log/Xorg.1.log
388 -rw-rw---- 1 portage portage 6268 Apr 1 19:35 /var/log/emerge-fetch.log
389 -rw-rw---- 1 portage portage 2687784 Apr 5 09:04 /var/log/emerge.log
390 -rw-r--r-- 1 root root 292292 Apr 5 08:34 /var/log/lastlog
391 -rw------- 1 root root 132157 Dec 28 20:30
392 /var/log/messages-20141228.gz
393 -rw------- 1 root root 277867 Jan 4 22:00
394 /var/log/messages-20150104.gz
395 -rw------- 1 root root 173843 Jan 12 10:20
396 /var/log/messages-20150112.gz
397 -rw------- 1 root root 1678586 Apr 5 18:10
398 /var/log/messages-20150405.gz
399 -rw-r--r-- 1 root root 0 Apr 5 18:14 /var/log/pm-powersave.log
400 -rw-r--r-- 1 root root 785 Oct 31 07:35
401 /var/log/pm-powersave.log-20141101.gz
402 -rw-r--r-- 1 root root 848 Dec 1 17:00
403 /var/log/pm-powersave.log-20141201.gz
404 -rw-r--r-- 1 root root 870 Jan 1 18:34
405 /var/log/pm-powersave.log-20150101.gz
406 -rw-r--r-- 1 root root 188788 Apr 5 08:34
407 /var/log/pm-powersave.log-20150405
408 -rw-rw-r-- 1 portage portage 565 Dec 26 20:53
409 /var/log/portage/elog/summary.log-20141228.gz
410 -rw-rw-r-- 1 portage portage 2281 Jan 4 21:14
411 /var/log/portage/elog/summary.log-20150104.gz
412 -rw-rw-r-- 1 portage portage 775 Jan 10 07:50
413 /var/log/portage/elog/summary.log-20150112.gz
414 -rw-rw-r-- 1 portage portage 96928 Apr 5 08:44
415 /var/log/portage/elog/summary.log-20150405
416 -rw-r--r-- 1 root root 0 Apr 5 18:14 /var/log/rc.log
417 -rw-r--r-- 1 root root 2493 Dec 28 08:33
418 /var/log/rc.log-20141228.gz
419 -rw-r--r-- 1 root root 4003 Jan 4 19:51
420 /var/log/rc.log-20150104.gz
421 -rw-r--r-- 1 root root 3026 Jan 12 08:57
422 /var/log/rc.log-20150112.gz
423 -rw-r--r-- 1 root root 16974 Apr 5 08:33
424 /var/log/rc.log-20150405.gz
425 -rw------- 1 root root 64064 Apr 5 08:34 /var/log/tallylog
426 -rw-rw-r-- 1 root utmp 54903 Apr 5 10:30 /var/log/wtmp-20150405.gz
427
428 I guess I have to figure out what the error message shown below is all
429 about:
430 501 Not authorised --- Reply not authenticated

Replies

Subject Author
Re: [gentoo-user] portage summary logs not rotated any more Mick <michaelkintzios@×××××.com>
Re: [gentoo-user] portage summary logs not rotated any more Alex Corkwell <i.am.the.memory@×××××.com>