I use the following code to make a saved search request. I get the output as JSON_ROWS format. I would like to get the result in JSON or XML format. Where i can specify the expected output format in the request ?
// The saved search created earlier
var searchName = "test";
// Retrieve the saved search collection
var mySavedSearches = service.savedSearches();
mySavedSearches.init(service, {app:"-"});
mySavedSearches.fetch(function(err, mySavedSearches) {
// Retrieve the saved search that was created earlier
var mySavedSearch = mySavedSearches.item(searchName);
// Run the saved search and poll for completion
mySavedSearch.dispatch({"args.splunkCMD": searchCommand}, function(err, job) {
// Display the job's search ID
sails.log("SplunkController::executeGenericSplunkRequest() Job SID: ", job.sid);
// Poll the status of the search job
job.track({
period: 200
}, {
done: function(job) {
sails.log("SplunkController::executeGenericSplunkRequest() Splunk request completed!");
// Get 10 results and print them
job.results({
count: 10
}, function(err, results, job) {
sails.log("SplunkController::executeGenericSplunkRequest() results = " +JSON.stringify(results, null, 2));
callback(results);
});
},
failed: function(job) {
console.log("Job failed")
},
error: function(err) {
done(err);
}
});
});
});