We're here to help!

How to configure logrotate for dbvnet log



OS: Linux/Unix

Note: This process also applies to other logs (not only dbvnet) that you want to configure logrotate.

Steps Performed

1) Create a simple config file called dbvnet (owned by root user) inside /etc/logrotate.d directory.

In the sample config file below, dbvnet log will rotate once its size > 1K, and original log will then be compressed. Please note threshold size can be set to a higher value (i.e. 1M) based on your requirement.


root@dbvlab03[/etc/logrotate.d]: more dbvnet
    size 1k
    rotate 4

2) Test if above configuration will take in effect, run the command below as root:

root@dbvlab03[/etc/logrotate.d]: logrotate -s /var/log/logstatus /etc/logrotate.d/dbvnet

Check the dbvnet log, old file should get zipped, and a new one is created.

oracle@dbvlab03[/usr/dbvisit/dbvnet/log]: ls -lrt
total 312
-rw-r--r-- 1 oracle oinstall     43 Mar  1 14:24 afiedt.buf
-rw-r--r-- 1 oracle oinstall 304440 Apr 28 20:41 access
-rw-r--r-- 1 oracle oinstall      0 May 30 11:35 dbvnet
-rw-r--r-- 1 oracle oinstall    393 May 30 11:35 dbvnet-20160530.gz

3) Once everything is tested fine, you can then schedule a cron job for logrotate command.

Some useful links around logrotate utility.


Have more questions? Submit a request