Scheduled Job Logs - cleanup/maintenace

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • khopper
    Senior Member
    • Sep 2017
    • 329

    Scheduled Job Logs - cleanup/maintenace

    Is there a need to keep the job logs for more than xx (30) days?
    I don't see the need to keep 45,000+ records saying success going back over 1 year.
    Is there anyway to automatically clean this up? Is it safe to delete the records older than xx (30) days without causing an issue?
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Check, when was the last successful executing of Cleanup Job
    Default period for jobs is 1 month.
    You can change it with param in config.php cleanupJobPeriod
    EspoCRM – Open Source CRM Application. Contribute to espocrm/espocrm development by creating an account on GitHub.

    Comment

    • khopper
      Senior Member
      • Sep 2017
      • 329

      #3
      It runs daily at 3 AM UST, all successful. Does the cleanup not remove old logs?
      From what I can tell it only removes "pending" items? Am i reading this correctly?
      In table `scheduled_job_log_record` there is no column for pending.

      Code:
       [TABLE]
      [TR]
      [TD]protected function cleanupJobs()[/TD]
       		[/TR]
      [TR]
      [TD] [/TD]
       			[TD]{[/TD]
       		[/TR]
      [TR]
      [TD] [/TD]
       			[TD]$pdo = $this->getEntityManager()->getPDO();[/TD]
       		[/TR]
      [TR]
      [TD] [/TD]
       			[TD] [/TD]
       		[/TR]
      [TR]
      [TD] [/TD]
       			[TD]$query = "DELETE FROM `job` WHERE DATE(modified_at) < ".$pdo->quote($this->getCleanupJobFromDate())." AND status <> 'Pending'";[/TD]
       		[/TR]
      [TR]
      [TD] [/TD]
       			[TD] [/TD]
       		[/TR]
      [TR]
      [TD] [/TD]
       			[TD]$sth = $pdo->prepare($query);[/TD]
       		[/TR]
      [TR]
      [TD] [/TD]
       			[TD]$sth->execute();[/TD]
       		[/TR]
      [TR]
      [TD] [/TD]
       			[TD]}[/TD]
       		[/TR]
      [/TABLE]

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        Is removes all old jobs with status not equals Pending.
        If you have duplicates in jobs with status Pending and deleted 0, only one left status Pending and deleted 0, other deleted 1
        cleanupJobs removes not pending

        to remove deleted go Administration > Settings > check Clean up deleted records

        Comment

        Working...