Migrate Cortex XSOAR objects to Elasticsearch for a multi-tenant environment.
The migration tool migrates Cortex XSOAR objects to an Elasticsearch database. When you run the migration, the contents of the Cortex XSOAR database are read and a corresponding object is created in Elasticsearch.
You run the migration tool from the main machine and each host machine. Migrate the main account on the main host, then the tenants on the main host, and then proceed to the other hosts and tenant accounts. For complex environments with multiple host machines, we recommend migrating all tenants on the host before proceeding to the next host.
In the BoltDB, data related to incidents and indicators is stored in partitions by month. To minimize downtime during the migration, we recommend you create a copy of the database, then migrate data that is older than three months from the copy, while continuing to work in your current environment. Once the initial migration is completed, you should then migrate the last three months.
Note
If you are working in an environment with remote repositories, you must run the migration separately on each environment. For example, if both your development and production environments are going to be used with an Elasticsearch database, you must migrate each of those environments, and each environment must use a different index prefix.
When you run the migration tool, parameter values identified in the etc/demisto.conf
file override values supplied for tool flags and default values. If no value exists in the demisto.conf
file, values supplied in the tool flags override default values, but do not write the values to the demisto.conf
file. For example, if the db-path
is identified in the configuration file, the tool will use the value in that file, not the value supplied or the default value, when running the tool.
Note
You cannot run more than one migration tool process at a time.
Always migrate older data before newer data. Migrating partitions out of order can cause duplicate incident ids.
By default, the migration tool skips over objects larger than 100 megabytes. After the migration process runs, you can view the skipped large objects and determine whether to migrate them. For more information, see Validate the Migration to Elasticsearch.
Download the migration tool by appending
downloadName=elasticsearch_migration_tool_6_10_0
to the end of the download link that you received, when installing Cortex XSOAR.For each host you want to migrate copy your database and migrate data from the copy database to Elasticsearch.
Copy the Cortex XSOAR database by doing one of the following:
Take a snapshot of the database.
Manually create a copy of the
/var/lib/demisto/
directory.
Copy the
demisto.conf
file.Edit the copy of the
demisto.conf
file, by adding your Elasticsearch configuration.Ensure that
elasticsearch
is the top-level object in thedemisto.config
file (within the main curly brackets).From the host, using the
demisto
orsudo
permissions, run the following command: command with either demisto or sudo permissions. Specify the following:sudo ./elasticMigrator -config-path <
path-of-copy-of-demisto.conf
> -db-path <path-of-the-copy-of-the-demisto-data
> -<flags>
For a full list of flags, see Migration Tool Flags.
For example, to exclude the last three months partitions, add the
-only-old-partitions
and-partitions-back flags
:sudo ./elasticMigrator -config-path /usr/local/dev/copy_of_demisto.conf -db-path /usr/local/dev/lib_demisto_copy/data -only-old-partitions -partitions-back 3
By default, the migration migrates the entire contents of the database and the tenants on the host.
To migrate only the host, use the
skip-accounts
flag.To migrate all accounts, use the
skip-main
flag.To migrate specific accounts, use the
accounts
andskip-main
flags.
Complete steps 1 to 3 in Validate the migration
After the migration of the data is complete and validated, migrate your data from the active database to Elasticsearch.
Create a backup copy of the
demisto.conf
file for your active database.Edit the demisto.conf for your active database to add your Elasticsearch configuration.
On the host (main or any other) stop the Cortex XSOAR server by running one of the following commands:
Ubuntu:
sudo service demisto stop
From the host, migrate the remaining months from the active database to Elasticsearch. Run the
sudo ./elasticMigrator
command with either demisto or sudo permissions. Use the-partitions-back
flag to specify the remaining partitions.For example,
sudo ./elasticMigrator -partitions-back 3
migrates the last three partitions, which would include the current month and the previous two months, as well as the main partition.By default, the migration migrates the entire contents of the database and the tenants on the host.
To migrate only the host, use the
skip-accounts
flag.To migrate all accounts, use the
skip-main
flag.To migrate specific accounts, use the
accounts
andskip-main
flags.
Validate the migration (all steps).
For any additional hosts that you want to migrate, repeat the steps above.
Migration Tool Flags
Flag | Type | Description | Required |
---|---|---|---|
| String | A comma-separated list of accounts to migrate. If not specified, all accounts are migrated. | Optional |
| String | The path to the configuration file for the server. Default: | Optional |
| String | The path to the database directory. Default: | Optional |
| Integer | The number of indicators per batch to write to Elasticsearch indices. Default: | Optional |
| String | The index prefix used in Elasticsearch. | Optional |
| String | The API key to connect to Elasticsearch. | Required (unless a username and password are used) |
| String | The password to connect to Elasticsearch. | Required (unless API key is used) |
| String | The URL of your Elasticsearch environment. Default: | Required |
| String | The username to connect to Elasticsearch. | Required (unless API key is used) |
| String | The path to the file with the IDs to ignore, per object. | Optional |
| String | The log level to display. Default: | Optional |
| String | The location of the log file. Default: | Optional |
| Integer | Log individual failed items, either in a single meta file, or file per item failure. Values:
| Optional |
| Boolean | By default, the Elasticsearch tool checks existing indices and migrates only the ones that are new. Using this flag, the Elasticsearch tool migrates all indices even if they currently exist. This is useful, for example, if there was an error or invalid data that was fixed. When used, the objects-to-migrate and objects-to-ignore flags are ignored. Values:
| Optional |
| String | Comma-separated list of objects not to migrate. When the | Optional |
| String | Comma-separated list of objects to migrate. When the | Optional |
| String | Comma-separated list of partitions to migrate. If no partitions are specified, all partitions are migrated. | Optional |
| String | Comma-separated list of partitions to exclude. | Optional |
| N/a | Show results of the previous migration. | Optional |
| Boolean | Does not migrate multi-tenant accounts. When set to true, only the main tenant or host database are migrated. Values:
| Optional |
| Boolean | Existing indicators are not modified during the migration. Values:
| Optional |
| Boolean | Does not migrate the main host or host database. Values:
| Optional |
| Integer | The maximum size, in megabytes, of objects that will be migrated to Elasticsearch. The default is 100 MB. | Optional |
| Boolean | Retry the migration of large objects when rerunning the migration tool. With this flag, the entire bucket that contains the skipped large object is migrated again, which may include data that was previously migrated. If new data has been added in Elasticsearch since the earlier migration, this data will be overwritten. | Optional |
| Boolean | When the partitions flag is used, the | Optional |
| Integer | Provides an option to migrate X number of partitions back. For example, migrating three partitions back migrates the current month and the previous two months. If set to 0 or not used, all partitions are migrated. | Optional |
| Boolean | Can only be used with the | |
| Boolean | Whether errors will result in termination of the migration tool. Default is | Optional |
| Boolean | If set to | Optional |
| N/a | Prints the migration tool version. | Optional |
| N/a | Answers yes to all questions, unless there is an error. | Optional |