Splunk Search

Splunk SDK fields

ifeldshteyn
Communicator

It seems like when one queries splunk the results you get are only the default indexed fields like source or sourcetype. We do not receive any extracted results that are present in Splunk web GUI.

If there is custom field extraction called bucket_id ...

Example: sourcetype=parent bucket_id=4 will return 8 results via web GUI but none via Splunk SDK search.

If there is no custom field extraction...

Example 2: sourcetype=parent will return 42 results via web GUI and Splunk SDK will return the same 42 results.

Am I doing something wrong or does this mean I have to do custom field extraction via Splunk SDK and not via Splunk?

UPDATE:

If I grab the field extraction definition and place it directly into the search using rex then the results are found in Splunk SDK.

Example 3: sourcetype=parent | rex field=_raw ".*bucket_id=(?P\w+)" | fields bucket_id shows up just fine in Splunk SDK.

This seems rather silly. What is the point of defining extractions within splunk if they are not used while performing non-gui searches? Please tell me I am missing something.

Thanks

Tags (3)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Are you running the SDK search from the same namespace as the field extraction?

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Sounds plausible - additionally, look into whether you can run searches in a specific app namespace from the SDK.

In case of the Java SDK, this is what you need: http://docs.splunk.com/DocumentationStatic/JavaSDK/1.3/com/splunk/JobArgs.html#setNamespace%28java.l...

0 Karma

ifeldshteyn
Communicator

Looks like this was a permission error. It was app-specific extraction and by changing perm to global read splunk SDK is able to see the extractions.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...