LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-17-2011, 07:28 AM   #1
Kohlu
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Rep: Reputation: Disabled
Log rotation for DHCP


Hi

I have a DHCP server working fine with me however its log file is excessively big I have heard there is an option of log rotation any idea how can it be implemented on a linux/solaris DHCP server.
 
Old 11-17-2011, 08:04 AM   #2
davemguru
Member
 
Registered: Apr 2006
Location: London
Distribution: Pclos,Debian,Puppy,Fedora
Posts: 87

Rep: Reputation: 42
Quote:
Originally Posted by Kohlu View Post
Hi

I have a DHCP server working fine with me however its log file is excessively big I have heard there is an option of log rotation any idea how can it be implemented on a linux/solaris DHCP server.
there is a linux command "logrotate" which is (typically) run automagically for you. All you would need to do is add the path of the dhcp log file that you want trimmed/archived/rotated to the logrotate configuration file.
I respectfully suggest you try the man page for the command http://linuxcommand.org/man_pages/logrotate8.html
This has a sample logrotate configuration file in it - which (I hope) will solve your problem.
Dave
 
Old 11-17-2011, 08:10 AM   #3
agentbuzz
Member
 
Registered: Oct 2010
Location: Texas
Distribution: Debian, Ubuntu, CentOS, RHEL
Posts: 131

Rep: Reputation: 25
Your /etc/logrotate.d/syslog should be changed on the syslog host to look like the following. This ensures that the DHCP logs are properly rotated and compressed, and that enough historical log data is retained for forensic purposes. You can add the path and name of the DHCP log to /etc/logrotate.d/syslog. Restart the syslogd or rsyslogd after you do this. Below is what the file might look like in your case.
Code:
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron /var/log/dhcp/dhcp.log {
    daily
    missingok
    rotate 26
    compress
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    Endscript
	}
 
Old 11-17-2011, 12:32 PM   #4
Kohlu
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the reply well the issue is that I am running DHCP on solaris

"SunOS 5.10 Generic_127127-11 sun4v sparc SUNW,Netra-T2000"


and i cant find the logrotate file anywhere how do I go ahead.
 
Old 11-17-2011, 12:48 PM   #5
agentbuzz
Member
 
Registered: Oct 2010
Location: Texas
Distribution: Debian, Ubuntu, CentOS, RHEL
Posts: 131

Rep: Reputation: 25
Solaris log rotation

in Solaris it's logadm.conf. Also, the DHCP log is in /var/adm on Solaris and not /var/log
 
Old 11-17-2011, 01:24 PM   #6
Kohlu
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
well this is how my logadm.conf looks like,how do I go ahead and will I have to make empty files and where for the logs to get transferred and what about the script to be used if any


"/etc/logadm.conf" 35 lines, 1515 characters
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "@(#)logadm.conf 1.7 07/01/10 SMI"
#
# logadm.conf
#
# Default settings for system log file management.
# The -w option to logadm(1M) is the preferred way to write to this file,
# but if you do edit it by hand, use "logadm -V" to check it for errors.
#
# The format of lines in this file is:
# <logname> <options>
# For each logname listed here, the default options to logadm
# are given. Options given on the logadm command line override
# the defaults contained in this file.
#
# logadm typically runs early every morning via an entry in
# root's crontab (see crontab(1)).
#
/var/log/syslog -C 8 -P 'Tue Nov 15 22:10:00 2011' -a 'kill -HUP `cat /var/run/s
yslog.pid`'
@
"/etc/logadm.conf" 35 lines, 1515 characters
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "@(#)logadm.conf 1.7 07/01/10 SMI"
#
# logadm.conf
#
# Default settings for system log file management.
# The -w option to logadm(1M) is the preferred way to write to this file,
# but if you do edit it by hand, use "logadm -V" to check it for errors.
#
# The format of lines in this file is:
# <logname> <options>
# For each logname listed here, the default options to logadm
# are given. Options given on the logadm command line override
# the defaults contained in this file.
#
# logadm typically runs early every morning via an entry in
# root's crontab (see crontab(1)).
#
/var/log/syslog -C 8 -P 'Tue Nov 15 22:10:00 2011' -a 'kill -HUP `cat /var/run/syslog.pid`'
/var/adm/messages -C 4 -P 'Fri Nov 11 22:10:00 2011' -a 'kill -HUP `cat /var/run/syslog.pid`'
/var/cron/log -P 'Wed Nov 16 22:10:00 2011' -c -s 512k -t /var/cron/olog
/var/lp/logs/lpsched -C 2 -N -t '$file.$N'
/var/fm/fmd/errlog -M '/usr/sbin/fmadm -q rotate errlog && mv /var/fm/fmd/errlog.0- $nfile' -N -s 2m
/var/fm/fmd/fltlog -A 6m -M '/usr/sbin/fmadm -q rotate fltlog && mv /var/fm/fmd/fltlog.0- $nfile' -N -s 10m
smf_logs -C 8 -s 1m /var/svc/log/*.log
#
# The entry below is used by turnacct(1M)
#
/var/adm/pacct -C 0 -N -a '/usr/lib/acct/accton pacct' -g adm -m 664 -o adm -p never
#
# The entry below manages the Dynamic Resource Pools daemon (poold(1M)) logfile.
#
/var/log/pool/poold -N -a 'pkill -HUP poold; true' -s 512k
~
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Log rotation.. Skillz Linux - Server 7 09-03-2011 04:49 PM
audit log rotation jnojr Linux - Security 4 06-02-2009 11:08 AM
How to change Debian log rotation of syslog and daemon.log onmountain Linux - Newbie 2 07-31-2008 02:27 AM
Log Rotation for snort log does not seem to be working CentOS4.5 JasonKretzer Linux - Security 3 06-25-2007 12:25 PM
Webalizer With Log Rotation dmedici Linux - Software 0 08-17-2004 09:06 AM


All times are GMT -5. The time now is 07:48 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration