Take the 2-minute tour ×

I have setup rsyslog to dump syslog data into mysql so that LogAnalyzer can easily access and interact with it.

How do I automate a job to remove syslog data of a certain age for the mysql database so it doesn't fill my HD?

share|improve this question
add comment

1 Answer

Have a cronjob executing a query like the following once a day:

 delete from syslogtable where timestampfield < subdate(curdate(), 31); 

Here, syslogtable is the table in question, timestampfield is the the DATE/TIME field containing the date of the log entry and deleted will a log entries older than 31 days. Adapt to your local situation (database, table and field names and the desired time to keep log entries).

share|improve this answer
add comment

Your Answer


