Announcement

Collapse
No announcement yet.

Option to Log specific status for Schedule Job log

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Option to Log specific status for Schedule Job log

    I notice there are far too many rows in the Job table and Import table. The real concern here is that the Job table records status of each schedule job run from the day of implementation. This could end up with millions of rows.This volume appears to make espocrm updates to run extremely slow especially if we upgrading from 5.7.11 to 5.9.3 when the database structures are being updated.

    I understand we have the opportunity to remove these entries but we cannot be doing this every day. I would propose enhancements to espocrm under Administration->Job to define what status to log, this way we can select to log specific statuses and reduce the number of entries substantially.

  • #2
    Hello,
    maybe a setting in config file

    PHP Code:
    <?php

    namespace Espo\Custom\Jobs;
    use 
    Espo\ORM\Entity;

    class 
    CleanJobs extends \Espo\Core\Jobs\Base
    {
    public function 
    run()
    {
    $GLOBALS['log']->warning"Begin Jobs CleanJobs & Optimize");
    $pdo $this->getEntityManager()->getPDO();
    $sql "DELETE FROM scheduled_job_log_record WHERE status='Success';DELETE FROM job WHERE status='Success'";
    $sth $pdo->prepare($sql);
    $sth->execute();

    $sql "SHOW TABLES";
    $sth $pdo->prepare($sql);
    $sth->execute();
    $tableList$sth->fetchAll();
    foreach (
    $tableList as $table) {
    $sql 'OPTIMIZE TABLE ' .$table[0] ;
    }

    $GLOBALS['log']->warning( @exec('php composer.phar -V') );
    $pid = @exec("php composer.phar self-update > /dev/null 2>&1 & echo $!;"$output);
    $GLOBALS['log']->warning( @exec('php composer.phar -V') );
    $GLOBALS['log']->warning"End Jobs CleanJobs & Optimize");
    }
    }

    Comment


    • #3
      It's possible to create a custom cleanup in an upgrade safe fashion https://github.com/espocrm/espocrm/b...leanup.php#L99.

      Comment

      Working...
      X