Splunk Search

Splunk SDK - Search String with parameter having Spaces

duddukuri
Explorer

By using Splunk SDK, able to use the below search string and get the results from SPlunk
String searchQuery_string = "search * | head 100";

We have a field by name message in Splunk, which can have values with spaces.
Example message 1 : "Started initialization"
Example message 2 : "Completed initialization in 86 ms"

We want to run search with the message="Completed i*"
In Splunk UI search this is working fine and giving results

When tried with below as the Query string, ZERO Results
String searchQuery_string = "search message='Completed i*'";
String searchQuery_string = "search message=Completed%20i*";

Kindly help me in this regard

Tags (1)
0 Karma
1 Solution

duddukuri
Explorer

normal Java escape character () worked
String searchQuery_string = "search message=\"Completed i*\"";

View solution in original post

0 Karma

duddukuri
Explorer

normal Java escape character () worked
String searchQuery_string = "search message=\"Completed i*\"";

0 Karma
Get Updates on the Splunk Community!

Splunk is Nurturing Tomorrow’s Cybersecurity Leaders Today

Meet Carol Wright. She leads the Splunk Academic Alliance program at Splunk. The Splunk Academic Alliance ...

Part 2: A Guide to Maximizing Splunk IT Service Intelligence

Welcome to the second segment of our guide. In Part 1, we covered the essentials of getting started with ITSI ...

Part 1: A Guide to Maximizing Splunk IT Service Intelligence

As modern IT environments continue to grow in complexity and speed, the ability to efficiently manage and ...