---
title: Kron PAM Log Rotation and Deleting Old Logs
slug: kronpam-support-and-maintenance-guides/kron-pam-log-rotation-and-deleting-old-logs
description: Learn about the various support channels offered by Kron for customers to resolve their operational issues. Open a support ticket via the Kron Support Portal or send an email to access 24/7 customer service. Find out how to provide evidence like log files
docTags: 
createdAt: 2022-08-23T11:09:57.000Z
---

Log rotation is the mechanism that archives an active log file (e.g., catalina.01-01-2020.out) and initializes a fresh one (e.g., catalina.out) for continued logging. Without periodic cleanup, these archived log files accumulate over time and may gradually consume significant disk space.

To remove outdated log files, use the bash script below. For continuous maintenance, it is recommended to schedule this script as a **cron job**, ensuring automated log cleanup at regular intervals.


`#!/bin/bash`
`#Time threshold to delete files (days). The files older than this threshold will be deleted.`
`threshold=90;`
`find /pam/logs/ -type f -mtime +$threshold -exec rm {} ;`
`find /pam/mobile/log/ -type f -mtime +$threshold -exec rm {} ;`
`find /pam/nssoapp/log/ -type f -mtime +$threshold -exec rm {} ;`
`find /pam/sql/log/ -type f -mtime +$threshold -exec rm {} ;`
`find /pam/sftp/log/ -type f -mtime +$threshold -exec rm {} ;`
`find /var/log/messages* -type f -mtime +$threshold -exec rm {} ;`
