Splunk Search

key error in Python call to search results Json

Athildjax64
New Member

I have a custom action alert based on an App
The search is looking for a file, event, and file type. it then pipes the sha256 hash of the file out to ensure it is listed.
When I look for that field in the json I get a key error.

I am using
resp_dict = json.loads(sys.stdn.read())
resp_dict['sha256']
I have also tried
resp_dict["sha256"]
resp_dict['_sha256']

All attempts to print or write the contents of the search results json fail.

Tags (1)
0 Karma

damien_chillet
Builder

You wrote sys.stdn, but i assume it's just a typo?

0 Karma

Athildjax64
New Member

Yes that is a typo here, in the code it is sys.stdin.read()

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...