To download more than 10 000 log entries from OpenSearch, you can use
elasticdump to
export data directly through the OpenSearch API. Designed to export large
datasets, elasticdump paginates through the results and bypasses the
default result window limitation of the OpenSearch Search API, so the export
size is limited only by the available storage.
You can run elasticdump either on your local machine or inside
the Kubernetes cluster:
Local installation is recommended when exporting a relatively small amount
of data that will be processed or analyzed on the local machine.
Requirements:
npm installed on the local machine
Network access to the OpenSearch endpoint, for example, through
kubectl port-forward
Running in the Kubernetes cluster is recommended when exporting large
volumes of data, minimizing network traffic between the cluster and the
local machine, or achieving the best export performance. Running
elasticdump inside the cluster is typically much faster because
it avoids transferring large amounts of data over the external network.
Before running elasticdump, collect the following parameters.
This section covers the most commonly used ones. For a complete list, refer to
the official elasticdump
documentation.
OPENSEARCH_URL
The OpenSearch endpoint to read data from. For example:
Local installation
Through kubectl port-forward:
http://localhost:49200
The index or index pattern to export. You can find the index pattern name in
OpenSearch Dashboards. For available index patterns, see
StackLight logging indices. For example, system*, audit*, or
kubernetes-events-*.
LIMIT
The number of documents retrieved per request. Smaller values reduce
the load on OpenSearch but increase the overall export time. Larger
values improve throughput but consume more cluster resources.
Defaults to 100. The maximum is 10000.
Start with 1000 or higher, then tune the value based on your
cluster CPU, memory, and overall performance characteristics to find
the best balance between throughput and resource usage.
OUTPUT
The path to the output JSON file. For example, export.json.
SEARCH_BODY
Optional. An OpenSearch Query domain-specific language (DSL) JSON object
used to filter the exported documents. Write it manually, or copy it from
OpenSearch Dashboards using Inspector > Request, and save it to
a JSON file. If omitted, all documents matching the selected index pattern
are exported.
Run elasticdump
After collecting the required parameters, run elasticdump,
substituting the collected parameter values: