export
The export operator does one of the following:
- Sends results generated by a search to an existing Cribl Lake Dataset. (You must create the Dataset first.)
- Sends results generated by a search to an existing Search Dataset. (You must create the Search Dataset first.)
- Writes aggregated search results to a metrics Dataset (logs to metrics).
- Creates or updates a lookup from search results.
Only Admin and Editor Search Members can run the
exportoperator. See also specific limitations on exporting to Lake Datasets, to Search Datasets, to metrics Datasets, and to lookups.
Syntax
The export operator supports four destination keywords: lake, search, metrics, and lookup. Specify one keyword
after to to pick the destination type.
If you don’t specify a keyword,
exporttries to write to a Cribl Lake Dataset, not to a Search Dataset or a metrics Dataset. To export to a Search Dataset, a metrics Dataset, or a lookup, you must use thesearch,metrics, orlookupkeyword explicitly.
Export to Cribl Lake:
Scope | export [ suppressPreviews=Previews ] to [ lake ] LakeDatasetName [ tee=Tee ]Export to a Search Dataset:
Scope | export [ suppressPreviews=Previews ] to search SearchDatasetID [ tee=Tee ]Export to a metrics Dataset:
Scope | export [ suppressPreviews=Previews ] to metrics [ MetricsDatasetID ]
[ tee=Tee ]
[ nameField=NameField ]
[ valueField=ValueField ]
[ typeField=TypeField ]
[ timeField=TimeField ]
[ type=histogram ]
[ labelFields=LabelFields ]Export to a lookup:
Scope | export [ mode=Mode ]
[ description=Description ]
[ suppressPreviews=Previews ]
[ fieldMapping=PairsToMap ]
[ compress=Compress ]
to lookup LookupName
[ tee=Tee ]
[ maxEvents=MaxEvents ]Arguments
Arguments are case-insensitive.
lake: Export to a Cribl Lake Dataset
- Scope: The events to search.
- Previews: Boolean. If
false(default), Cribl Search displays intermediate statistics (previews) during the export operation. Iftrue(so,suppressPreviews=true), you’ll see only the final statistics, once the export operation completes. - LakeDatasetName: The Cribl Lake Dataset to export results to. You must choose an already existing Dataset.
- Tee: Boolean. If set to
true, the search results are shown as usual. Iffalse(which is the default), instead of the results, Cribl Search displays statistics related to the export.
Dataset Limitations
Typically, you’re exporting data in which Cribl Search has already parsed field names and values. This makes the data compatible with Lakehouses. However, if you happen to send unparsed data, you won’t be able to search it at Lakehouse speed.
The
exportoperator can’t send data to a Cribl Lake Dataset that is populated via Splunk Cloud Direct Access.
search: Export to a Cribl Search Dataset
This option exports results to a Search Dataset hosted on a Cribl-managed lakehouse engine.
- Scope: The events to search.
- Previews: Boolean. If
false(default), Cribl Search displays intermediate statistics (previews) during the export operation. Iftrue(so,suppressPreviews=true), you’ll see only the final statistics, once the export operation completes. - SearchDatasetID: The ID of an existing Search Dataset to export results to. The Dataset must be hosted on a lakehouse engine that is in Ready status.
- Tee: Boolean. If set to
true, the search results are shown as usual. Iffalse(which is the default), instead of the results, Cribl Search displays statistics related to the export.
metrics: Export to a Metrics Dataset
Preview Feature
Cribl is still developing this Preview feature. We don’t recommend using it in a production environment, because the feature might not be fully tested or optimized for performance, and related documentation could be incomplete.
Please continue to submit feedback through normal Cribl support channels, but assistance might be limited while the feature remains in Preview.
Use export to metrics to turn aggregated search results into stored metrics. Typically, you start by filtering logs, summarizing them
with operators such as summarize and bin, shaping name/value/type fields, and then exporting. This is a
Search query path (ad hoc or scheduled), not a continuous stream-based logs-to-metrics pipeline.
- Scope: The events to search. Each result that you export should already look like a metric sample (name, numeric value, optional type, optional labels, and optional timestamp).
- Previews: Boolean. If
false(default), Cribl Search displays intermediate statistics (previews) during the export operation. Iftrue(so,suppressPreviews=true), you’ll see only the final statistics, once the export operation completes. - MetricsDatasetID: Optional ID of the metrics Dataset to write to. Defaults to
metrics. Cribl Search auto-provisions a metrics Dataset for each lakehouse engine: the first engine’s Dataset is namedmetrics, and each additional engine getsmetrics_<engine_id>. See Review the Metrics Dataset. - Tee: Boolean. If set to
true, the search results are shown as usual. Iffalse(which is the default), instead of the results, Cribl Search displays statistics related to the export (including events sent and events dropped). Use those stats to confirm the input shape: more than zero events sent and zero events dropped means the events were shaped correctly. Export is strict about the expected fields and values. - NameField: Field that holds the metric name. Defaults to
name. Empty or missing names are dropped. - ValueField: Field that holds the numeric metric value. Defaults to
value. Values must be finite numbers. Non-numeric or non-finite values are dropped. - TypeField: Field that holds the scalar metric type for counter/gauge export. Defaults to
type. Accepted values aredefault,counter, andgauge(case-insensitive). If the field is missing or empty, Cribl Search usesdefault. Other values are dropped. Ignored whentype=histogram. - TimeField: Field that holds the metric timestamp. Optional. If you set
timeFieldand the operator can’t find or coerce that timestamp, the event is dropped. If you omittimeField, Cribl Search looks for_timeon each event. If_timeis also missing, it generates a timestamp at insertion time withnow()as a Unix epoch millisecond value. For scalar export, each row gets its own generated timestamp. For histogram export, observations in the same flush batch share one generated timestamp. Supported inputs include epoch seconds, milliseconds, microseconds, and nanoseconds, ISO-style and Search-style datetime strings, JavaScriptDatevalues, and structured timestamp objects. - Type: Literal export type. The only accepted value is
histogram. Usetype=histogramfor histogram export. Whentype=histogramis set, histogram mode takes precedence overtypeField. Literaltype=counterandtype=gaugeare not supported - set those types withtypeFieldinstead. - LabelFields: Metric labels (dimensions). Pass a list of fields
(
labelFields=[host, service, status]) or a single object field whose keys become label names (labelFields=labels). In object mode, the field must be a flat object with no nested objects - for example{pod_name: "api-1", _123zone: "us-west-2"}. Label values are stringified. Null values and nested object values are dropped. Nested paths and quoted field names are supported in list mode (for exampleservice.name,["weird field"]). Wildcard field selectors are not supported. Label names are normalized for metric storage: characters outsidea-z,A-Z,0-9, and_become_, and names that don’t start with a letter or_get a leading_.
Metrics Limitations
- Export to metrics requires metrics export permission, or Maintainer access on the target metrics Dataset.
- Destination Datasets are the auto-provisioned metrics Datasets on a lakehouse engine (
metricsormetrics_<engine_id>).- For counters and gauges, set the type with
typeField. Use thetype=argument only forhistogram.- Invalid events are dropped during export. When
tee=false, check export statistics for events sent and events dropped. Drop reasons can includemissing_name,invalid_value,invalid_type, andinvalid_timestamp.- When you bin by time, assign the binned value back to
_time(for example_time=bin(_time, 1m)). A barebin(_time, ...)renames the column. If you settimeFieldand that timestamp is missing or invalid, export drops the data. If you omittimeField, export uses_timewhen present, otherwise it generates a timestamp withnow().- Metrics field parameters (
nameField,valueField,typeField,timeField,type,labelFields) apply only toexport to metrics. They are rejected onlake,search, andlookupexports.
Metric Types for Export
- Scalar (default path): One ingest row per event. Use for counts and gauges. Set the type with
typeField(default,counter, orgauge). - Histogram (
type=histogram): Each input event is one numeric sample. Cribl Search groups samples that share the same name, timestamp, and labels, then assembles a native histogram. Pass many sample rows (same name/labels/time, different values) rather than pre-built histogram buckets.
Logs to Metrics Pattern
- Run a search against a log Dataset.
- Filter and summarize (for example, errors per minute per service).
- Shape fields so each result has a metric name, a numeric value, and optional type and labels.
- Pipe to
| export to metricswith field mappings. If you used time binning, assign it as_time=bin(_time, ...)so export can find_time. To use a different timestamp field, settimeFieldto that field. - Run the search and check the export statistics: events sent should be greater than zero, and events dropped should be zero.
- Save and schedule the search if you want metrics to keep updating.
lookup: Export to a Lookup
- Scope: The events to search.
- Mode: Supports
create,overwrite, andappend. Defaults tocreate. If the lookup doesn’t exist, it defaults tocreate, simplifying scheduled searches. When usingappendmode, you can includedescription,fieldMapping, andcompressparameters, and if the lookup exists, they are ignored. This streamlines the process of appending data to a lookup as part of scheduled searches, as the table is generated during the first scheduled run and continues to append new content in subsequent runs. - Description: String. The description to give the lookup.
- Previews: Boolean. If
false(default), Cribl Search displays intermediate statistics (previews) during the export operation. Iftrue(so,suppressPreviews=true), you’ll see only the final statistics, once the export operation completes. - PairsToMap: String. Comma-separated list of
sourceName:targetNamepairs to map event property names to CSV output names. Defaults to all of the last known list of projected fields. - Compress: String. Defaults to
autowhere files larger than 16 KB are compressed. Set astrueto compress no matter the size andfalseto not compress the file. - LookupName: The lookup file name, without the file extension. For example: a file name of
users.csvis entered asusers. - Tee: Boolean. Defaults to
falsewhere search results are not shown in Cribl Search. Instead, you get an event with the URL and the number of bytes and events sent or dropped. Whentruethe search results are displayed and no stats are provided. For example:tee=true. - MaxEvents: The maximum number of events that
exportwill write to the table. Cribl Search will drop any events beyond this limit. Defaults to10000(10,000 rows). This is also the maximum number of events that this operator’slookupmode can handle, so entering a higher MaxEvents still effectively sets a limit of10000.
Lookup Limitations
You can’t use the
createmode on an existing lookup. This will trigger an error.You can’t use the
exportoperator to create or update Pack lookups. For example,| export to lookup pack(packId).lookupIdwill not work.
_raw in Exports to Cribl Lake
Exports to Lake Datasets include the _raw field. If you want to remove this field, use the
project-away operator.
_time in Exports to Cribl Lake
Cribl Lake handles the _time field automatically, so Datatype timestamp settings in
Cribl Search don’t apply.
If the source event has no _time field, Cribl Lake adds this field, setting its value to now() at write time.
Examples
Export search results to the myDataset Lake Dataset:
dataset="cribl_search_sample"
| export to lake myDataset
// you can also drop the `lake` keyword
dataset="cribl_search_sample"
| export to myDatasetExport search results to a Lake Dataset, and remove the _raw field:
dataset="cribl_search_sample"
| export to lake myDataset
| project-away _rawExport search results to the mySearchDataset Search Dataset:
dataset="cribl_search_sample"
| export to search mySearchDatasetCount log levels and export them as metrics (uses default name, value, and destination Dataset metrics):
dataset="cribl_internal_logs" level!=null
| summarize value=count() by level
| project name="log_level_count", level, value
| export to metrics labelFields=[level]Export HTTP 5xx errors per minute as a counter metric:
A bare
bin(_time, ...)insummarizerenames the_timecolumn. Preserve the name with_time=bin(_time, 1m)so export can find_time(or settimeFieldto your timestamp field). Otherwise, if you settimeField=_timeand the column is missing, export drops the events.
dataset="my_logs"
| where status >= 500
| summarize value=count() by _time=bin(_time, 1m), service, status
| extend name="http_errors_total", type="counter"
| export to metrics
timeField=_time
nameField=name
valueField=value
typeField=type
labelFields=[service, status]Export to a non-default metrics Dataset on another lakehouse engine:
dataset="my_logs"
| summarize value=count() by _time=bin(_time, 1m), service
| extend name="requests_total", type="counter"
| export to metrics metrics_my_engine
timeField=_time
labelFields=[service]Export request duration samples as a histogram:
dataset="my_logs"
| where isnotnull(duration_ms)
| project _time, service, value=duration_ms
| extend name="http_request_duration_ms"
| export to metrics
type=histogram
timeField=_time
nameField=name
valueField=value
labelFields=[service]Create a lookup named mylookup with the time and status fields.
dataset="cribl_search_sample" status="*"
| limit 5
| export description="My lookup" fieldMapping="_time:time,status:status" to lookup mylookupYou can verify the contents of the lookup with this command - replacing mylookup with the name of your own lookup
file:
dataset="$vt_lookups" lookupFile="mylookup"Export a lookup with two columns, method and cnt.
dataset=$vt_dummy event<600
| extend _time=_time-rand(600), method=iif(event%2>0, "GET", "POST")
| summarize cnt=count() by method
| export mode=append description="Table with http methods count" to lookup mymethodsTo verify that table was exported.
dataset="cribl_lookups" lookup_table=mymethods
| project method, cnt
| render tableEnrich exported results with context about the search that produced them. Using jobID(), user(), and query() adds a provenance trail that lets you distinguish between different result sets in Lake and trace each record back to the search that created it:
dataset=myDataset
| extend search_id=jobID(), run_by=user(), source_query=query()
| export to lake myEnrichedDataset