Splunk Dev

python SDK integration with Splunk

srijondas
Explorer

I am trying to implement EventingCommand interface, and return just one custom event at the end of  processing multiple events in Splunk. I have the code written in Python and integrated. But for some reason, the code returns multiple events in Splunk.

Can someone point out what is the problem here?

 

 

import sys from splunklib.searchcommands
import dispatch, EventingCommand, Configuration

@Configuration()
    class testpython(EventingCommand):
   

    def transform(self, records):
        list1 =[{'count': 1}]
        return list1

if __name__ == "__main__": dispatch(testpython, sys.argv, sys.stdin, sys.stdout, __name__)

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

Unleash the Power of Splunk MCP and AI, Meet Us at .Conf 2025, and Find Even More New ...

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

Observability Professionals: Build Resilience and Visibility with These .conf25 ...

  If you're focused on performance, availability, and full-stack visibility, the Observability track at ...

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...