|
| 1 | +--- |
| 2 | +navigation_title: Migrate with {{ls}} |
| 3 | +applies_to: |
| 4 | + stack: ga |
| 5 | + deployment: |
| 6 | + ess: ga |
| 7 | + ece: ga |
| 8 | +products: |
| 9 | + - id: elasticsearch |
| 10 | + - id: logstash |
| 11 | + - id: cloud-hosted |
| 12 | + - id: cloud-enterprise |
| 13 | + - id: cloud-kubernetes |
| 14 | +--- |
| 15 | + |
| 16 | +# Migrate data with {{ls}} [migrate-with-ls] |
| 17 | + |
| 18 | +You can use {{ls}} to migrate data from an {{ech}} deployment to an {{serverless-full}} project. |
| 19 | + |
| 20 | +The Logstash input has cursor like-functionality that keeps your place. |
| 21 | + |
| 22 | +[Tracking a field's value across runs](https://www.elastic.co/docs/reference/logstash/plugins/plugins-inputs-elasticsearch) |
| 23 | + |
| 24 | +Familiarity with {{ech}}, {{es}}, and {{ls}} is helpful, but not required. |
| 25 | + |
| 26 | +:::{note} |
| 27 | +This guide focuses on data migration. Dashboards, visualizations, pipelines, templates, and other {{kib}} assets must be migrated separately using the {{kib}} [export/import APIs](https://www.elastic.co/docs/api/doc/kibana/group/endpoint-saved-objects) or recreated manually. |
| 28 | +::: |
| 29 | + |
| 30 | +## Prerequisites [migrate-prereqs] |
| 31 | + |
| 32 | +Ensure that you have: |
| 33 | + |
| 34 | +- {{ech}} deployment with data to migrate |
| 35 | +- {{serverless-full}} project configured and running |
| 36 | +- {{ls}} [installed](https://www.elastic.co/downloads/logstash) on your local machine or server |
| 37 | +- API keys in {{ls}} format for authentication with both deployments |
| 38 | + |
| 39 | + |
| 40 | +## Process overview [migration-overview] |
| 41 | +* [Configure {{ls}}](#configure-ls) |
| 42 | +* [Run {{ls}}](#run-ls) |
| 43 | +* [Verify data migration](#verify-migration) |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +## Step 1: Configure {{ls}} [configure-ls] |
| 48 | +Create a new {{ls}} configuration file (migration.conf) with these settings: |
| 49 | + |
| 50 | +``` |
| 51 | +input { |
| 52 | + elasticsearch { |
| 53 | + cloud_id => "<HOSTED_DEPLOYMENT_CLOUD_ID>" # Your Hosted Deployment's Cloud ID |
| 54 | + api_key => "<HOSTED_API_KEY>" # Your Hosted Deployment API key |
| 55 | + index => "index_pattern*" # Your index or pattern (such as logs-*,metrics-*) |
| 56 | + docinfo => true |
| 57 | + } |
| 58 | +} |
| 59 | +
|
| 60 | +output { |
| 61 | + elasticsearch { |
| 62 | + hosts => [ "https://<SERVERLESS_HOST_URL>:443" ] # URL for your Serverless project URL, set port as 443 |
| 63 | + api_key => "<SERVERLESS_API_KEY>" # API key (in Logstash format) for your Serverless project |
| 64 | + ssl_enabled => true |
| 65 | + index => "%{[@metadata][input][elasticsearch][_index]}" # Retain original index names |
| 66 | + } |
| 67 | +
|
| 68 | + stdout { codec => rubydebug { metadata => true } } |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +When you create an API key for Logstash, be sure to select **Logstash** from the **API key** format dropdown. This option formats the API key in the correct `id:api_key` format required by Logstash. |
| 73 | + |
| 74 | + |
| 75 | +## Step 2: Run {{ls}} [run-ls] |
| 76 | + |
| 77 | +Start {{ls}}: |
| 78 | + |
| 79 | +``` |
| 80 | +bin/logstash -f migration.conf |
| 81 | +``` |
| 82 | + |
| 83 | +## Step 3: Verify data migration [verify-migration] |
| 84 | + |
| 85 | +After running {{ls}}, verify that the data has been successfully migrated: |
| 86 | + |
| 87 | +1. Log in to your {{serverless-full}} project. |
| 88 | +2. Navigate to Index Management and select the index. |
| 89 | +3. Verify that the migrated data is visible. |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | +:::{tip} |
| 96 | +To migrate multiple indexes at the same time, use a wildcard in the index name. |
| 97 | +For example, `index => "logs-*"` migrates all indices starting with `logs-`. |
| 98 | +::: |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +## More resources [more-resources] |
| 103 | +* https://www.elastic.co/docs/reference/logstash/plugins/plugins-inputs-elasticsearch |
| 104 | +* https://www.elastic.co/docs/reference/logstash/plugins/plugins-inputs-elasticsearch#plugins-inputs-elasticsearch-cursor |
| 105 | +* [API key in LS format](https://www.elastic.co/docs/reference/logstash/connecting-to-serverless#api-key) |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +## FAQ |
| 111 | + |
| 112 | +ToDo @karenzone: Continue with FAQ |
| 113 | + |
| 114 | + |
0 commit comments