---
title: Cron - Quick Reference
slug: klevu-magento-v4/indexing-cron
docTags: 
createdAt: 2024-09-23T16:13:46.215Z
---

Klevu adds multiple cron jobs to manage the registration of attributes and the indexing of entity data.

:::hint{type="info"}
All cron tasks added by version 4.x of the Klevu integration use the dedicated `klevu` cron group, allowing granular configuration of scheduling and run options.

We recommend using the native Magento cron to run these jobs, configuring schedules if necessary, rather than a custom server-side cron implementation of the CLI command.
:::

In a non-production environment, you may not be running the cron.&#x20;
You can trigger only the Klevu cron jobs using the following command.

```shell
bin/magento cron:run --group klevu
```

## Attribute Discovery

Runs once a day as a fall back in case the addition or removal of any attributes was missed by our event observers and plugins.

:::CodeblockTabs
module-m2-indexing/etc/crontab.xml

```xml
<job name="klevu_indexing_discover_attributes"
     instance="Klevu\Indexing\Cron\DiscoverAttributes"
     method="execute">
    <schedule>52 1 * * *</schedule>
</job>
```
:::

## Attribute Sync

Runs every 10 minutes (by default, the schedule is configurable in the admin)

:::CodeblockTabs
module-m2-indexing/etc/crontab.xml

```xml
<job name="klevu_indexing_sync_attributes"
     instance="Klevu\Indexing\Cron\SyncAttributes"
     method="execute">
    <config_path>klevu/indexing/attribute_cron_expr</config_path>
</job
```
:::

## Entity Discovery

Runs once a day as a fall back in case the addition or removal of any entities was missed by our event observers and plugins.

:::CodeblockTabs
&#x20;module-m2-indexing/etc/crontab.xml

```xml
<job name="klevu_indexing_discover_entities"
     instance="Klevu\Indexing\Cron\DiscoverEntities"
     method="execute">
    <schedule>0 2 * * *</schedule>
</job>
```
:::

## Entity Sync

Runs every 30 minutes (by default, the schedule is configurable in the admin)

:::CodeblockTabs
module-m2-indexing/etc/crontab.xml

```xml
<job name="klevu_indexing_sync_entities"
     instance="Klevu\Indexing\Cron\SyncEntities"
     method="execute">
    <config_path>klevu/indexing/entity_cron_expr</config_path>
</job>
```
:::

## Entity Sync History Consolidation

Runs once a day to consolidate the days sync history into one database entry.

:::CodeblockTabs
module-m2-indexing/etc/crontab.xml

```xml
<job name="klevu_indexing_sync_history_consolidation"
     instance="Klevu\Indexing\Cron\SyncHistoryConsolidation"
     method="execute">
    <schedule>2 0 * * *</schedule>
</job>
```
:::

## Entity Sync History Consolidation Clean

Runs once a day to remove sync history older than x days.&#x20;

:::CodeblockTabs
module-m2-indexing/etc/crontab.xml

```xml
<job name="klevu_indexing_sync_history_consolidation_clean"
   instance="Klevu\Indexing\Cron\SyncHistoryConsolidationClean"
   method="execute">
  <schedule>10 0 * * *</schedule>
</job>>
```
:::

Number of days defaults to 7 and is configured in the admin `klevu/indexing/remove_indexing_history_after_days`&#x20;
