Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.