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!

Mastering Threat Intelligence in ES 8.5, Splunk AI Assistant v2, and More from Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Break the Build: Inside the KubeDoom Lounge at .conf26

    You step up to the machine. The pixelated corridors of a certain 1993 FPS load in front of you, EMP Pulse ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...