Skip to content

CLI commands for logging

The logs are currently stored in a separate MongoDB database. The following commands are available to manage the logs:

Convert logs collection to a capped collection

A MongoDB capped collection is a fixed-size collection that automatically overwrites its oldest entries when it reaches its maximum size. This is useful for logs because it ensures that the collection does not grow indefinitely.

By default, the logs collection is not capped. To convert it to a capped collection, use the following command:

bin/console synqup:convert-capped-collection

Options:

  • --size: (Optional) The size of the capped collection in bytes. The default size is 5 GB.
  • --db-logs: (Optional) A Boolean flag to indicate whether to use the logs database. If set, the logs will be stored in the logs database. If not set, the logs will be stored in the default database. Defaults to true.
  • --collection: (Optional) The name of the collection to use. Default value: LogEntry.
  • --drop-and-recreate: (Optional) If this option is set, the existing collection will be dropped and recreated as a capped collection. This will delete all existing log entries. Use with caution.

As mentioned, this command can be applied to other collections as well. Another example would be the ValidationInfo collection.

Create random log entries

To create random log entries for testing purposes, use the following command:

bin/console synqup:create-log-entries

Arguments:

  • count: The number of log entries to create.

Options:

  • --create-context-aware-logs: (Optional) If set, context-aware logs (with flow_execution_id and dispatcher_mapping_id) will be created. This is useful for testing log filtering based on context.