logrotate not working in 3.0 [Solved]

Non release banter
User avatar
Ed_P
Contributor
Contributor
Posts: 8578
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

logrotate not working in 3.0 [Solved]

Post#1 by Ed_P » 10 Apr 2014, 18:52

Code: Select all

guest@porteus:~$ su
Password: 
root@porteus:/home/guest# logrotate /etc/logrotate.conf
root@porteus:/home/guest# ls -al /var/log
total 1848
drwxr-xr-x 38 root root    320 Apr 10 14:31 ./
drwxr-xr-x 43 root root    200 Apr 10 14:46 ../
drwxr-xr-x  2 root root     60 Apr 10 14:31 ConsoleKit/
-rw-r--r--  1 root root  41493 Apr 10 14:31 Xorg.0.log
-rw-r--r--  1 root root  43951 Apr 10 14:30 Xorg.0.log.old
-rw-------  1 root root      0 Apr  5 03:02 btmp
-rw-------  1 root root      0 Nov 14 09:26 btmp.1
-rw-r-----  1 root root   2387 Apr 10 14:31 cron
-rw-r-----  1 root root 403744 Apr 10 14:32 debug
-rw-r--r--  1 root root  44080 Apr 10 14:31 dmesg
-rw-r--r--  1 root root      0 Feb 14 21:17 faillog
-rw-r--r--  1 root root      0 Apr  8  2000 lastlog
-rw-r-----  1 root root      0 Jun 22  2013 maillog
-rw-r-----  1 root root 758631 Apr 10 14:51 messages

etc
messages is above the limit.

Not sure if this is wide spread or only in my desktop. This command worked in 2.1.
Last edited by Ed_P on 17 Apr 2014, 15:49, edited 1 time in total.

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5667
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: logrotate not working in 3.0

Post#2 by fanthom » 10 Apr 2014, 19:37

no surprise - works here :)
please boot in 'Always Fresh' then copy some 1MB+ file as /var/log/wtmp and run 'logrotate /etc/logrotate.conf' as root or wait till 19.30 when daily cron job will do it.

must be something wrong with your changes - did you use save.dat from 2.1? if yes then some old settings must override default ones from 3.0.
Please add [Solved] to your thread title if the solution was found.

User avatar
Ed_P
Contributor
Contributor
Posts: 8578
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: logrotate not working in 3.0

Post#3 by Ed_P » 10 Apr 2014, 22:02

fanthom wrote:please boot in 'Always Fresh'
Fresh mode

Code: Select all

guest@porteus:~$ su
Password: 
root@porteus:/home/guest# logrotate /etc/logrotate.conf
error: /etc/logrotate.conf:31 duplicate log entry for /var/log/wtmp
root@porteus:/home/guest# ls -al /var/log
total 204
drwxr-xr-x 30 root root   300 Apr 10 17:30 ./
drwxr-xr-x 30 root root   180 Apr 10 17:30 ../
drwxr-xr-x  2 root root    60 Apr 10 17:30 ConsoleKit/
-rw-r--r--  1 root root 41413 Apr 10 17:30 Xorg.0.log
-rw-------  1 root root     0 Nov 14 09:26 btmp
-rw-r-----  1 root root    99 Apr 10 17:30 cronhe limit.
-rw-r-----  1 root root 19967 Apr 10 17:30 debug
-rw-r--r--  1 root root 43492 Apr 10 17:30 dmesg
-rw-r--r--  1 root root     0 Feb 14 21:17 faillog
-rw-r--r--  1 root root     0 Apr  8  2000 lastlog
-rw-r-----  1 root root     0 Jun 22  2013 maillog
-rw-r-----  1 root root 56925 Apr 10 17:31 messages
Didn't have to copy a file, messages larger than the limit.
must be something wrong with your changes - did you use save.dat from 2.1?
No but I did rebuiild it using 2.1's save.dat.

RebuildGuest.sh

Code: Select all

#!/bin/sh

echo Run from LXterminal else SpaceFM bookmarks won't be restored.
echo Use FireFox to restore FireFox's bookmark backup and edit History 
echo    Preferences and browser.bookmarks.max_backups setting.
echo Use Razor Autosuspend to set Lid Closed to Sleep.
echo Use /usr/lib64/java/jre/bin.jcontrol to adjust Java security.
echo 
echo Be sure to update save.dat name and location.
read

if [ `whoami` != "root" ]; then
  ktsuss "$0"
  exit
fi

mloop  /mnt/sda6/porteussave.dat

#http://forum.porteus.org/viewtopic.php?f=81&t=3075&p=21675#p21675
#cp -r -d /mnt/loop/home/guest/*  2>/dev/null    /home/guest/
cp -r -d /mnt/loop/home/guest/*                  /home/guest/
#http://forum.porteus.org/viewtopic.php?f=81&t=3250&p=23071#p23066
chown guest:guest -R                             /home/guest
cp -r -d /mnt/loop/home/guest/.config/spacefm/*  /home/guest/.config/spacefm/
cp -r -d /mnt/loop/etc/NetworkManager/system-connections/*  /etc/NetworkManager/system-connections
I have also made the folllowing changes.

Fixes.sh

Code: Select all

#!/bin/sh

if [ `whoami` != "root" ]; then
  ktsuss "$0"
  exit
fi

# disables the Acer's touchpad's jumping
# http://forum.porteus.org/viewtopic.php?f=81&t=1955&start=45#p13596
cp -a /home/guest/syndaemon.desktop  /home/guest/.config/autostart

# No sound - on an Acer 722 netbook
# http://forum.porteus.org/viewtopic.php?f=81&t=2926#p20365
cp -a /home/guest/asound.conf     /etc/
/etc/rc.d/rc.alsa restart

# My purge/compress Syslogs parms - 500 > 300
# http://forum.porteus.org/viewtopic.php?f=81&t=2998&p=21365#p21253
# Copy /etc/logrotate.d/syslog to /home/guest & edit 1st
cp -a /home/guest/syslog          /etc/logrotate.d/

# 3.0 Tool panel height problem.
# http://forum.porteus.org/viewtopic.php?f=81&t=3246&p=23131#p23058
cd /usr/share/icons/Faenza/apps/48/
mv spacefm.png spaceXfm.png

echo B4
synclient | grep Palm
echo  
sh /home/guest/touchpad.sh
echo Aft
synclient | grep Palm
echo 
echo -en "PalmDetect = 1?\n"
read

exit
if yes then some old settings must override default ones from 3.0.
A reasonable assumption but I don't think so. And to ease your doubt:

My syslog

Code: Select all

/var/log/btmp /var/log/cron /var/log/debug /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler /var/log/syslog /var/log/wtmp {
     rotate 1
     size 300k
     compress
    sharedscripts
    postrotate
   /bin/kill -HUP `cat /var/run/syslogd.pid 2>/dev/null` 2>/dev/null || true
    endscript
}

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5667
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: logrotate not working in 3.0

Post#4 by fanthom » 11 Apr 2014, 08:05

messages larger than the limit.
nope - 'ls' gives size in bytes and not kilobytes. run 'ls -alh' to show size in kilobytes.
Please add [Solved] to your thread title if the solution was found.

User avatar
Ed_P
Contributor
Contributor
Posts: 8578
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: logrotate not working in 3.0

Post#5 by Ed_P » 11 Apr 2014, 14:44

Good grief. :oops: Got to get new glasses. :( Yes, 56925 is less than 300000. Will retest and post back. Sorry.

BTW Should the end "/var/log/wtmp" be removed to resolve the "error: /etc/logrotate.conf:31 duplicate log entry for /var/log/wtmp" error?

User avatar
Ed_P
Contributor
Contributor
Posts: 8578
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: logrotate not working in 3.0

Post#6 by Ed_P » 11 Apr 2014, 18:12

I give up. I can't get a file to copy to /var/log/.

Logrotate probably works for you because you are signed in as root, the rest of us are signed in as guest. My OP shows my messages file as 758631 and that is indeed larger than 500000 and my 300000. Thus my logrotate.sh script, that I run before shutting down, that worked fine in 2.1, is not working in 3.0. And apparently the 19:30 version isn't working either.

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: logrotate not working in 3.0

Post#7 by brokenman » 11 Apr 2014, 20:02

Logrotate probably works for you because you are signed in as root
I never sign is as root and in fact nobody ever has the need to sign in as root. Of course /var/log is not available to guest because that would mean any old user can mess with the logs and an administrator would not want that. You can copy your file as root in two ways when you are logged into your machine as guest.

In a terminal

Code: Select all

su
toor
## You are now root
cp /path/to/my/file.xzm /var/log/
Or open a root file manager (should be one in your menu) and copy it manually.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8578
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: logrotate not working in 3.0

Post#8 by Ed_P » 11 Apr 2014, 22:26

Thanks brokenman but I think I'm just going to try deleting the whole /var/log folder when I shut down. The messages file is larger than the syslog size limit so logrotate obviously isn't working and there is nothing in the folder that I care to keep.

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: logrotate not working in 3.0

Post#9 by brokenman » 12 Apr 2014, 00:14

Thanks brokenman but I think I'm just going to try deleting the whole /var/log folder when I shut down.
If you are saving changes this will break your system. /var/log/packages for example contains a record of all the packages you have installed and is essential for porteus to function.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8578
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: logrotate not working in 3.0

Post#10 by Ed_P » 12 Apr 2014, 01:57

I don't install packages. I add modules which are loaded when I boot. But I see that there are many packages in the /var/log/packages folder pre-installed so you made your point.

But I was thinking more along the lines of deleting all the files referenced in the syslog file anyways. Everything outside the subfolders.

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: logrotate not working in 3.0

Post#11 by brokenman » 12 Apr 2014, 03:17

You are pretty much safe to delete anything with a log prefix in that folder.

find /var/log/packages -name "*.log" | xargs rm

If any of these logs are filling up so much that they require removing then something is wrong that needs to be addressed.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8578
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: logrotate not working in 3.0

Post#12 by Ed_P » 12 Apr 2014, 04:25

brokenman wrote:You are pretty much safe to delete anything with a log prefix in that folder.

find /var/log/packages -name "*.log" | xargs rm
Thanks but I I was thinking more along the lines of anything with a suffix of .log, .old, .1, .gz plus the files
dmesg secure faillog lastlog btmp maillog porteus-livedbg spooler messages cron debug and wtmp.
If any of these logs are filling up so much that they require removing then something is wrong that needs to be addressed.
Messages is the big one so far, and why I posted this thread, but I have no use for any of the others either, so why keep them.

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5667
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: logrotate not working in 3.0

Post#13 by fanthom » 12 Apr 2014, 08:58

The messages file is larger than the syslog size limit so logrotate obviously isn't working
it is working. i will make a video for you to prove it but then you have to buy me a bottle of whiskey.
deal?
Please add [Solved] to your thread title if the solution was found.

User avatar
Ed_P
Contributor
Contributor
Posts: 8578
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

logrotate not working in 3.0

Post#14 by Ed_P » 12 Apr 2014, 18:23

:loleverybody:

No problem man. But you must use RazorQT plus my save.dat file. ;)

And I will also need to see some id to be sure you're old enough to drink. You have to be over 21 in this country to drink. :)

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5667
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: logrotate not working in 3.0

Post#15 by fanthom » 12 Apr 2014, 20:23

But you must use RazorQT plus my save.dat file.
save.dat does not count as you could delete half of the system (delete /var/log? - wonderful idea).

once again - have a look on my first post in this topic:
http://forum.porteus.org/viewtopic.php? ... 335#p23660
in short - it is a problem with your save.dat so better create new one.

advice: use root account only when you are 100% sure what you are doing.
Please add [Solved] to your thread title if the solution was found.

Post Reply