Need guidance on logrotate on FreeNAS ?

Status
Not open for further replies.

Varun Chandak

Dabbler
Joined
Jul 20, 2014
Messages
29
I have FreeNAS 9.2.1.7 installed on a USB drive and recently I checked that logs are not getting rotated. Can anyone guide me on how to proceed with this ?

Shall I install logrotate using pkg_add command directly on FreeNAS Installation or in a jail. I have no idea on how to install and configure jail as I couldn't find any decent tutorial regarding this.

Please Help.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
Well, considering nothing can nor should be installed on FreeNAS that kind of narrows it down.

If you want help with installing and using jails, see our documentation. ;)

Also, in case you didn't know, the old pkg system was EOL..... TODAY! 9/1/2014. So that's not an option either. ;)
 

Varun Chandak

Dabbler
Joined
Jul 20, 2014
Messages
29
okay...! I'll try to implement a jail and update if logrotate is working properly or not. :)
 

Dennis K.

Explorer
Joined
Feb 17, 2014
Messages
70
Logrotation should be working. On FreeBSD this is being done by "newsyslog". Also, "/etc/newsyslog.conf" seems to be configured appropriately.

Edit: you can also run "newsyslog -v" manually to see whats going on.
 

Varun Chandak

Dabbler
Joined
Jul 20, 2014
Messages
29
Logrotation should be working. On FreeBSD this is being done by "newsyslog". Also, "/etc/newsyslog.conf" seems to be configured appropriately.

Edit: you can also run "newsyslog -v" manually to see whats going on.

Here's my output:

Code:
[root@freenas] ~# newsyslog -v
Processing /etc/newsyslog.conf
/var/log/all.log <2J>: does not exist, skipped.
/var/log/amd.log <2J>: does not exist, skipped.
/var/log/auth.log <7J>: size (Kb): 5 [100] --> skipping
/var/log/console.log <5J>: does not exist, skipped.
/var/log/cron <3J>: size (Kb): 5 [100] --> skipping
/var/log/daily.log <7J>: does not exist, skipped.
/var/log/debug.log <2J>: does not exist, skipped.
/var/log/kerberos.log <7J>: does not exist, skipped.
/var/log/lpd-errs <7J>: size (Kb): 1 [100] --> skipping
/var/log/maillog <7J>: --> will trim at Tue Sep  2 00:00:00 2014
/var/log/messages <5J>: size (Kb): 61 [100] --> skipping
/var/log/monthly.log <12J>: does not exist, skipped.
/var/log/pflog <3J>: does not exist, skipped.
/var/log/ppp.log <3J>: size (Kb): 1 [100] --> skipping
/var/log/security <10J>: size (Kb): 1 [100] --> skipping
/var/log/sendmail.st <2>: does not exist, skipped.
/var/log/weekly.log <5J>: does not exist, skipped.
/var/log/wtmp <3>: --> will trim at Wed Oct  1 05:00:00 2014
/var/log/xferlog <2J>: size (Kb): 1 [100] --> skipping
/var/log/nginx-access.log <1J>: size (Kb): 69 [100] --> skipping
/var/log/nginx-error.log <1J>: size (Kb): 5 [100] --> skipping
/var/log/ups.log <2J>: size (Kb): 5 [100] --> skipping


my messages log doesn't rotate as it hasn't reached 100 Kb threshold, i guess.

How to rotate logs on per day basis ?
 

Varun Chandak

Dabbler
Joined
Jul 20, 2014
Messages
29
Yep.

newsyslog is already being called once per hour by cron:
Code:
grep -C1 newsyslog /etc/crontab
# Rotate log files every hour, if necessary.
0   *   *   *   *   root   newsyslog
#
and what about the messages log to get rotated each day ???
 

Varun Chandak

Dabbler
Joined
Jul 20, 2014
Messages
29
okay, this is the output of my newsyslog.conf file:
Code:
/var/log/all.log                        600  2     *    @T00  J
/var/log/amd.log                        644  2     100  *     J
/var/log/auth.log                       600  7     100  *     JC
/var/log/console.log                    600  5     100  *     J
/var/log/cron                           600  3     100  *     JC
/var/log/daily.log                      640  7     *    @T00  JN
/var/log/debug.log                      600  2     100  *     J
/var/log/kerberos.log                   600  7     100  *     J
/var/log/lpd-errs                       644  7     100  *     JC
/var/log/maillog                        640  7     *    @T00  JC
/var/log/messages                       644  q5    100  *     JC
/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  *     JC
/var/log/security                       600  10    100  *     JC
/var/log/sendmail.st                    640  2     *    168   B
/var/log/weekly.log                     640  5     1    $W6D0 JN


I think I should change the messages log parameter to maillog one and count = 7 to 30 for 30 days. Am I right ?
 

Dennis K.

Explorer
Joined
Feb 17, 2014
Messages
70
I think I should change the messages log parameter to maillog one and count = 7 to 30 for 30 days. Am I right ?
This is possible, but not recommended. FreeNAS should only be administered through the webinterface. Upgrading to a new version of FreeNAS would result in losing your custom configuration.
 
Status
Not open for further replies.
Top