Getting Data In

How can I change the output of a search job to JSON?

mwcooley
Explorer

I'm not a developer, so please bear with me. i'm using service.savedSearches.fetch, then mySavedSearch.dispatch(function(err, job) to dispatch my search. It's working, but the object returned is in JSON_ROWS.

The Splunk docs here seem to suggest I can change the output from JSON_ROWS to plain JSON, but I can't figure out how to change from the default value.

thanks,
mike

0 Karma

mwcooley
Explorer

Hi,

I figured it out, with the help of a co-worker.

I added output_mode to the job:

job.results({
count: 10,
output_mode: "JSON"
}, function(err, myObj, job) {
...
});

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...