All Apps and Add-ons

Splunk Add-on Builder: Can you help me with Splunk SDK for Python, splunklib.modularinput.EventWriter, event split issue?

mferjani
New Member

Hi,

I'm facing a random data loss issue when i split an event (list) into many events (one per element).
Here is a snippet of my code :

for element in json_response:
    try:
        data = json.dumps(element)
        event = helper.new_event(data=data, source=source, index=index, sourcetype=sourcetype)
        ew.write_event(event)        
    except Exception as e: 
        raise e

My json_response contains 8 elements. I added counters before and after the for loop. I always got 8 (in log file), but when i try a search for the same time-range, i find only two or one events.

Could you please help ?

Many thanks in advance.

Regards,

--
Mohammed

0 Karma

chli_splunk
Splunk Employee
Splunk Employee

Did you get some exceptions? Can you post your codes with counters? Any results when you test your codes in AoB? Thanks.

0 Karma
Get Updates on the Splunk Community!

Exporting Splunk Apps

Join us on Monday, October 21 at 11 am PT | 2 pm ET!With the app export functionality, app developers and ...

Cisco Use Cases, ITSI Best Practices, and More New Articles from Splunk Lantern

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

Build Your First SPL2 App!

Watch the recording now!.Do you want to SPL™, too? SPL2, Splunk's next-generation data search and preparation ...