Logging in RT on daily basis

How can I setup my RT so that the log files will be created on daily basis instead of appending to the same log file. The problem with appending the log in the same file is that the file is getting big and ends up consuming more space.

I need to create the file the log file on daily basis and after that I will create a cron job which will remove 10 days older files. Please help me to create the log files which will be created daily.

Currently my RT_SiteConfig.pm looks like:

Set($LogDir, '/var/log/RT);
Set($LogToFileNamed , “rt.log”);

Take a look at the man pages for ‘logrotate’ and ‘logrotate.conf’. You can set things up to rotate them daily or weekly, keep ‘N’ copies, compress old ones, etc. Newer systems use the directory /etc/logrotate.d to store individual recipes in, so you also have a set of examples.

Hi Sudeepta,

A example of configuration:


Set($LogDir, ‘/opt/rtlog’);
Set($LogToFileNamed , “rt.log”);

Then you create for example the rt file and place the following lines:
vi /etc/logrotate.d/rt

/opt/rtlog/*log {
rotate 10
/sbin/service httpd reload > /dev/null 2>/dev/null || true

You can get a full list of commands used in logrotate configuration files by checking the man page:

man logrotate

Are you sure you really want those log files active all the time? Would it not be better to use syslog generally

I have the below configuration in SiteConfig.pm file.
Set($LogToSyslog, ‘’);
Set($LogToFile, ‘info’);

What does it mean by Are you sure you really want those log files active all the time? As everyday logging is been done in one file , it is getting big, so I need to create the log file daily and create a cron job whilch will run daily and delete the old log file.

Please guide how can I achieve that, is there any problem in doing this.

I mean, you can turn that logging off. You only really need it if your developing or debugging something

But Actually I need the log, so that if what happens I should be able to know. But instead of appending the same file , I just need to create them daily

Then as others have already said, look into logrotate

Thanks fro your solution.

Is the postrotate script here does a server restart?

If yes does the server restart required daily?
How the logrotate will run daily, do we have to set a cron job for the same?

The server does not restart.

There’s a shell script there aptly named logrotate.


I mean to say the postrotate script here have a httpd reload over there.
Is httpd reload is necessary? Can it possible to do without httpd reload?
Have one doubt what is the difference between httpdreload, create and copytruncate? The three looks the same.

The lines between postrotate and endscript are executed after the log file is rotated, you can eliminate them without problem.

I do not use create and copytruncate.

I think if we will remove these post rotate scripts, then the new file is being created but it is still updating the old file and size if new file remains 0kb until we reload the apache

You have several options to try with logrotate, you can try it. The example that I put to you I use it to date without any inconvenience.

Ohh Okk… Thank you!!

Need one more information.

When I am rotating using my command inside /etc/logrotate.d(rt is my created file).
logrotate - f rt
it is creating the new file.
But it is not being executed automatically within cron.daily. Could you please help??

Set this in /etc/crontab:
10 1 * * * root run-parts /etc/cron.daily

Is the cron.daily not executed from anacrontab. I could see there is a entry in anacrontab to run cron.daily and I get regular mails that anacrontab is being successfully executed and in /var/spool/anacron I could see that todays datestamp is being updated.

10 1 * * * root run-parts /etc/cron.daily

I have given this line, but still it is not running

try run-parts with a -V and see if you get anything