How to create new dhcpd.log

  • 7008673
  • 31-May-2011
  • 30-Apr-2012

Environment

Novell DHCP
Novell Open Enterprise Server 2 (OES 2) Linux
SUSE Linux

Situation

*One of the log files on the server is getting big and you are not able to view it properly.
*You want to create a new log file and do not want to use logrotate for the same.
*You want to troubleshoot an issue and capture only the new information in the log
*You have already renamed the log file and created a new empty file, but the service is still writing to the renamed file.
*You have renamed dhcpd.log and created a new file but the dhcpd service is still wrting to the old file.

Resolution

Standard way to manage log files is to use logrotate. However, if you are not familiar with its usage or do not want to use it, do the following:
 
1. Stop the required service
eg. rcnovell-dhcpd stop
We are taking an expample of novell-dhcpd service here.
 
2. Rename the log file
eg. mv /var/log/dhcpd.log /var/log/dhcpd.log.old
 
3. Create a new empty log file
eg. touch /var/log/dhcpd.log
 
4. Restart the system log for the server
eg. rcsyslog restart
 
5. Start the service again
eg. rcnovell-dhcpd. start
 
6. Verify that the service is now using the new log file.
eg. tail -f /var/log/dhcpd.log
and press CTRL + C to end vewing the log file.
 

Additional Information

Note: The logging for the entire server will be restart when syslog is restarted. It is recommended to schedule this operation during non business hours.
 
* It was always recommeded to use logrotate to manage log files.