Skip to content

Maintenance Commands

Commands for data migration, statistics synchronization, and other operational maintenance tasks.


move-references

Migrate vulnerability references from the deprecated reference + reference_vulnerability_association model to the newer VulnerabilityReference model. This is a data migration utility needed during specific version upgrades.

Note: This command was previously undocumented. It should be run when upgrading from versions that used the old reference model.

faraday-manage move-references [OPTIONS]

Options

Option Type Default Description
-a, --all-workspaces Boolean false Migrate references in all workspaces
-w, --workspace-name String Migrate references in a specific workspace

One of --all-workspaces or --workspace-name must be provided.

Behavior

  1. Queries the old reference / reference_vulnerability_association tables for the specified workspace(s)
  2. Inserts the data into the new VulnerabilityReference table using INSERT ... ON CONFLICT DO NOTHING
  3. Verifies the migration by comparing row counts between old and new tables
  4. If counts match: deletes the old association records
  5. If counts differ: prints a warning and does not delete old records

Examples

# Migrate a single workspace
faraday-manage move-references -w my-project

# Migrate all workspaces (may take a while for large databases)
faraday-manage move-references -a true

Output

Working on workspace my-project ...
Moved 1523 reference/s from my-project
Deleting old references associations ...
All associations were deleted successfully

Or if no references are found:

Working on workspace my-project ...
No references found...

Common Errors

Error Cause Solution
Options required Neither workspace option provided Use -a true or -w <workspace-name>
There are differences between old references and moved references... Count mismatch after migration Investigate manually; old data is preserved

sync-hosts-stats

Recalculate and synchronize vulnerability severity statistics for all hosts across workspaces. This is useful when dashboard statistics become out of sync with actual vulnerability data.

Note: This command was previously undocumented. Use it when dashboard vulnerability counts or severity distributions appear incorrect.

faraday-manage sync-hosts-stats [OPTIONS]

Options

Option Type Default Description
-a, --async-mode Boolean false Run the update asynchronously via Celery task queue

Behavior

  1. Queries all host IDs and workspace IDs from the database
  2. Dispatches the update_host_stats task with the collected IDs
  3. In synchronous mode (default): runs the update inline, blocking until complete
  4. In async mode: dispatches a Celery task to process in the background (requires Celery to be enabled in settings)

Community Edition Note

Async mode requires Celery to be enabled (faraday_server.celery_enabled). If Celery is not enabled and async mode is requested, the command will print an error:

Error: To use async mode you must have celery enabled in your settings

For community installations, use the default synchronous mode.

Examples

# Synchronous update (recommended for community edition)
faraday-manage sync-hosts-stats

# Asynchronous update via Celery (requires Celery enabled)
faraday-manage sync-hosts-stats -a true

Output

[*] Syncing hosts stats ...
[*] Found 2847 hosts ...
[!] This may take a while ...
[*] Updating synchronously

When to Use

  • Dashboard vulnerability counts don't match actual data
  • After bulk vulnerability import/deletion
  • After database restoration from backup
  • After upgrading Faraday versions
  • When severity distribution charts appear incorrect