Splunk Dev

How to search custom fields from Splunk SDK?

scottmacdonald
New Member

I can't find documentation anywhere on how to format search strings for the Splunk SDK. Every single example provided just uses:

search index=_internal | head 10

I'm just trying to search on a custom field I use in my application, so I thought this would work:

search index=myindex mycustomfield=xyz

but that just gives me an error: Bad Request: FATAL: Unknown search command mycustomfield

How do I format this as I want? And perhaps more importantly where is this documented how the SDK expects requests to be formatted?

0 Karma

micahkemp
Champion

See if this answer from yesterday helps.

0 Karma

scottmacdonald
New Member

@micahkemp that actually did help but not for the reason you would think...turns out it was a dumb mistake on my part, I had two variables declared named search and searchStr and i mixed the two up and was passing in the wrong one without the 'search' part at the beginning. Stupid mistake but thanks for the tip

0 Karma

damien_chillet
Builder

Hi scott,

Can you provide us with a sample of the code you're using to get this error?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...