Splunk Search

Include CSV Report in Splunk Search Job API Results for Ticketing Integration

cipher
Explorer

Hi,

I’ve set up an alert in Splunk that triggers whenever there are log gaps (missing logs) from hosts, based on the RecordNumber Windows events within a defined time window. I also have a Python script that creates tickets in our custom ticketing tool by fetching data from Splunk using the /search/jobs/{sid}/results API. The payload currently includes the list of affected hosts and the count of hosts.

| eval status="There were gaps in Splunk logs from the above hosts in last 1h"
| stats
dc(host) AS affected_hosts
values(host) AS hosts
values(status) AS status

Now, I’d like to enhance the ticket by attaching a CSV report of the gaps. Specifically, I want the API response to include a CSV file in the payload whenever I pull the data, so that the ticket contains both the summary and the detailed report.


Is there a way to achieve this?

Labels (1)
Tags (1)
0 Karma
1 Solution

livehybrid
SplunkTrust
SplunkTrust

Hi @cipher 

If you add output_mode=csv to your existing /search/jobs/{sid}/results you will get your results as a CSV format.

For more info see https://help.splunk.com/en/splunk-enterprise/search/search-manual/9.2/export-search-results/export-d...

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

View solution in original post

livehybrid
SplunkTrust
SplunkTrust

Hi @cipher 

If you add output_mode=csv to your existing /search/jobs/{sid}/results you will get your results as a CSV format.

For more info see https://help.splunk.com/en/splunk-enterprise/search/search-manual/9.2/export-search-results/export-d...

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...

Splunk Developers: Construct Your Future at the .conf26 Builder Bar

Calling all Splunk architects, platform admins, and app developers: the site is open, and the blueprints are ...

Quick connection discovery mode for forwarders

When a Splunk forwarder loses connectivity to its indexers, it does not always reconnect immediately. In many ...