| Author |
Linux system Logs (redhat)
|
|
| prezbedard 2003-01-14, 8:31 am |
| Is it possible to change the size of system logs such as the boot log so it does not overwrite itself. Also When viewing system logs there is a setting to refresh after x amount of seconds. Is that just refreshing the file itself in case you are monitoring it?
Thanks | |
| Mr. Linux Guy 2003-01-14, 9:57 am |
| man logrotate
man syslog | |
| prezbedard 2003-01-14, 1:12 pm |
| quote: Originally posted by Mr. Linux Guy
man logrotate
man syslog
Thanks
I'm going to try this right now. | |
| Mr. Linux Guy 2003-01-14, 1:23 pm |
| Let me know if the info presented isn't enough to get you what you need. | |
| prezbedard 2003-01-14, 1:29 pm |
| quote: Originally posted by Mr. Linux Guy
Let me know if the info presented isn't enough to get you what you need.
I just looked at it and it gave me the Linux Programmers Jounral. It seemed to be talking about writing scripts to control log files. I think I need some more newbie friendly information.
Though I understood what it was saying I
don't think I could actually do it.
Thanks | |
| Mr. Linux Guy 2003-01-14, 1:54 pm |
| cd to /etc/logrotate and then open the file that you want to rotate. The "rotate n", where n is some whole number is what you are after. You can also have the logs compressed and mailed to you if you like. Add something like:
code:
/var/log/boot {
rotate 5
weekly
size=1000K
mail me@myserver.com
postrotate
/sbin/killall -HUP syslogd
}
You could also try a simple script that does a:
cat dmesg >> /var/log/boot.msg
when your system boots up. | |
| prezbedard 2003-01-14, 2:44 pm |
| quote: Originally posted by Mr. Linux Guy
cd to /etc/logrotate and then open the file that you want to rotate. The "rotate n", where n is some whole number is what you are after. You can also have the logs compressed and mailed to you if you like. Add something like:
code:
/var/log/boot {
rotate 5
weekly
size=1000K
mail me@myserver.com
postrotate
/sbin/killall -HUP syslogd
}
You could also try a simple script that does a:
cat dmesg >> /var/log/boot.msg
when your system boots up.
Thanks,
/var/log/boot {
rotate 5
weekly
size=1000K
The N is for the number of weeks?
also can weekly be set to monthly, daily,yearly etc? | |
| Mr. Linux Guy 2003-01-14, 2:57 pm |
| N is the number of copies of old logs to be kept about. Like messages.1, . . . messages.4. Yes, you can set it to monthly I think, but be warned, these log files can take up *huge* amounts of space, so be careful about setting the rotation frame too large. | |
| prezbedard 2003-01-14, 3:07 pm |
| quote: Originally posted by Mr. Linux Guy
N is the number of copies of old logs to be kept about. Like messages.1, . . . messages.4. Yes, you can set it to monthly I think, but be warned, these log files can take up *huge* amounts of space, so be careful about setting the rotation frame too large.
The only logrotate folder I found was the following
/etc/logrotate.d/
under that I opened syslog
Here is what it looks like:
"
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
"
Do I put
/var/log/boot {
rotate 5
weekly
size=1000K
mail me@myserver.com
between sharedscripts and postrotate?
Thanks
This is getting very interesting and fun indeed. I will be careful about the size of the log file thanks for the warning. | |
| Mr. Linux Guy 2003-01-14, 3:36 pm |
| I'd create a new file for "boot", as I think the logrotate program processes every file in this directory and if I am not mistaken, to keep things simple, the custom is to use one file per service to be rotated (mine has squid, rpm, and apache in it). | |
| prezbedard 2003-01-14, 7:09 pm |
| quote: Originally posted by Mr. Linux Guy
I'd create a new file for "boot", as I think the logrotate program processes every file in this directory and if I am not mistaken, to keep things simple, the custom is to use one file per service to be rotated (mine has squid, rpm, and apache in it).
So I should create for example boot1.log
in that directory and put boot1 as in the following example.
code:
/var/log/boot1 {
rotate 5
weekly
size=1000K
mail me@myserver.com
postrotate
/sbin/killall -HUP syslogd
}
Thanks | |
| Mr. Linux Guy 2003-01-15, 6:18 am |
| Yeah, that would be what I would do. |
|
|
|