Getting Data In

Fetching data in splunk using API

anujsharma19109
New Member

Hi Team,
I need suggestion please, I want to import XML data to Splunk using below py script

My concerns are:

  1. Can I directly configure  py script output to index data in Splunk using inputs.conf, or first I need to save output into a .csv file. If yes can anyone please suggest some approach so that data does not get changed after storing it into a new .csv file.
  2. 2)How can I configure that .py file to fetch data in every 5 min.

CODE :

import requests
import xmltodict
import json

url = "https://www.w3schools.com/xml/plant_catalog.xml"

response = requests.get(url)
content=xmltodict.parse(response.text)
print(content)

 

Labels (2)
0 Karma
Get Updates on the Splunk Community!

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...