Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.