LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 10-25-2005, 11:02 PM   #1
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
newsyslog


Hello, I was wondering if someone could help me out. I would like to rotate my log files on the last day and the 23rd hour of each month and store them in /root/logs/. Inside of root logs would be a dir for each file I am rotating, like httpd* would go into the apache dir etc...
I am not to sure how to get each log file to go into a specific dir. man newsyslog said -d , but isnt that from command line and not crontab, or how do I need to do it from crontab??
I have only added into newsyslog.conf entries for http-error , httpd-access and vsftpd. I have also read I may need to HUP apache, is this true? What about vsftpd?
Any help is always appreciated.

Here is /etc/crontab:

# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: src/etc/crontab,v 1.32 2002/11/22 16:13:39 tom Exp $
#
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour mday month wday who command
#
*/5 * * * * root /usr/libexec/atrun
#
# Save some entropy so that /dev/random can re-seed on boot.
*/11 * * * * operator /usr/libexec/save-entropy
#
# Rotate log files every hour, if necessary.
0 * * * * root newsyslog
# Perform daily/weekly/monthly maintenance.
1 3 * * * root periodic daily
15 4 * * 6 root periodic weekly
30 5 1 * * root periodic monthly
#
# Adjust the time zone if the CMOS clock keeps local time, as opposed to
# UTC time. See adjkerntz(8) for details.
1,31 0-5 * * * root adjkerntz -a

#adding this for logcheck to run every half hour
0,15,30,45 * * * * root /bin/sh /usr/local/etc/logcheck.sh


Here is /etc/newsyslog.conf

# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/var/log/all.log 600 7 * @T00 J
/var/log/amd.log 644 7 100 * J
/var/log/auth.log 600 7 100 * J
/var/log/console.log 600 5 100 * J
/var/log/cron 600 3 100 * J
/var/log/daily.log 640 7 * @T00 JN
/var/log/debug.log 600 7 100 * J
/var/log/kerberos.log 600 7 100 * J
/var/log/lpd-errs 644 7 100 * J
/var/log/maillog 640 7 * @T00 J
/var/log/messages 644 5 100 * J
/var/log/monthly.log 640 12 * $M1D0 JN
/var/log/pflog 600 3 100 * JB /var/run/pflogd.pid
/var/log/ppp.log root:network 640 3 100 * J
/var/log/security.ipfilter.log 600 10 100 * J
/var/log/http-error.log 640 13 * $MLH23 J
/var/log/httpd-access.log 640 13 * $MLH23 J
/var/log/vsftpd.log 640 13 * $M1H23 J
/var/log/sendmail.st 640 10 * 168 B
/var/log/slip.log root:network 640 3 100 * J
/var/log/weekly.log 640 5 1 $W6D0 JN
/var/log/wtmp 644 3 * @01T05 B
/var/log/xferlog 600 7 100 * J


Many thanks.

Last edited by lord-fu; 10-25-2005 at 11:03 PM.
 
Old 10-26-2005, 12:03 PM   #2
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Original Poster
Rep: Reputation: 30
Anyone with some help?
 
Old 10-28-2005, 12:08 PM   #3
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Original Poster
Rep: Reputation: 30
Sorry to repost to this thread but it was coming up in google searches and had no responses from this forum. With help from a thread I started in another forum I have what I think may be the solution. Although not fully tested yet, it is at least a step in the right direction.
quoted from Lin-chi from :http://www.freebsdforums.org/forums/...d=1#post191445

Using the -a option to move archived log files into different directories will require breaking down the entry in cron I believe. I would do something like the following:

1. Move entries that are going into their own directories into a new conf file, e.g. /etc/newsyslog.separate.conf. These would be your httpd, ftpd, etc.
2. Leave all log rotation entries going into the same directory, i.e. system logs, in /etc/newsyslog.conf.
3. Change the cron entry for the system logs to move archives to the same directory: 0 * * * * root newsyslog -a /root/log/system
4. Add cron entries for the specific directories:
0 23 * * * root newsyslog -f /etc/newsyslog.separate.conf -a /root/log/httpd /var/log/http-error.log /var/log/httpd-access.log
0 23 * * * root newsyslog -f /etc/newsyslog.separate.conf -a /root/log/ftpd /var/log/vsftpd.log

I'd personally change the rotation time for the specific logs to "$M1D0" so I could use the "@monthly" string for the schedule in cron.

BTW, I have no idea on the HUP for vsftpd. Try running newsyslog manually on it and see if it continues to write to the log after it's been rotated. Of course, you can only do this if you can afford to lose a few lines of log.
[end quote]


Hope that helps some of the people that were doing google searches like I was from pulling up a thread with no responses.

Last edited by lord-fu; 10-28-2005 at 12:10 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 11:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration