When getting current Search Job results using Sumo Logic's Search Job API (https://github.com/SumoLogic/sumo-ap...Search-Job-API) the results can be nicely formatted into a JSON file.

Using an open source Python tool called mjson that comes with the standard Python libraries you can put your results in an easier to read format. You can reference the tool at the following links:



When running your command to get the results, simply add the following. Note the > results.txt which is saving the results to a file named results.txt.

| grep "\"_raw\":" | sed 's/^[ \t]*"_raw": "//g' | sed 's/",[ \t]*$//g' > results.txt

A full example command is as follows, note you must input your accessid and accesskey, as well as ensure the correct endpoint is set and set the search job ID given when creating the search job:

curl -sS -b cookies.txt -c cookies.txt -H "Accept: application/json" --user ACCESSID:ACCESSKEY "https://api.sumologic.com/api/v1/sea...=0&limit=10000" | grep "\"_raw\":" | sed 's/^[ \t]*"_raw": "//g' | sed 's/",[ \t]*$//g' > results.txt

Now that the results on in the file results.txt you can use the mjson.tool on the file to make it easier to read as follows:

cat results.txt | python -mjson.tool >> results.json

Now you have a new file results.json that will be much easier to read.