<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Splunk SDK API Search String Syntax Problem in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-SDK-API-Search-String-Syntax-Problem/m-p/323223#M4574</link>
    <description>&lt;P&gt;Hi Charles,&lt;/P&gt;

&lt;P&gt;After creating the job with the API, you can go find it in the job activity to see if it ran as you expected.&lt;BR /&gt;
I would suggest you have a look at the User_Name field.&lt;/P&gt;

&lt;P&gt;Because of escaping you may be loosing a "\" in the User_Name you are looking for, therefore getting no results!&lt;/P&gt;</description>
    <pubDate>Thu, 07 Dec 2017 10:29:36 GMT</pubDate>
    <dc:creator>damien_chillet</dc:creator>
    <dc:date>2017-12-07T10:29:36Z</dc:date>
    <item>
      <title>Splunk SDK API Search String Syntax Problem</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-SDK-API-Search-String-Syntax-Problem/m-p/323222#M4573</link>
      <description>&lt;P&gt;I Have Two Queries That Both Work In Splunk Web Ui&lt;/P&gt;

&lt;P&gt;This Query Works In Web UI BUT NOT In Api&lt;BR /&gt;
I Probaly Have A Syntax Problem&lt;/P&gt;

&lt;P&gt;Can I Get Some Help&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; var query = "search index=main sourcetype=dg_dlp host=G2UA7301XP2E earliest=\"12/5/2017:00:00:00\" latest=\"12/5/2017:23:59:00\" Operation=12 User_Name=\"logon\\212000846\"";

static async Task Run(Service service)
{
  try
  {
    // Login
    await service.LogOnAsync("admin", "changeme");

    // This One Returns Data In Web UI and Data In API
    //var query = "search index=_internal | head 5";

    // This One Returns Data In Web UI and NO Data IN API -- Must Be A Syntax Problem
    var query = "search index=main sourcetype=dg_dlp host=G2UA7301XP2E earliest=\"12/5/2017:00:00:00\" latest=\"12/5/2017:23:59:00\" Operation=12 User_Name=\"logon\\212000846\"";
    var args = new JobArgs
    {
      // For a full list of options, see:
      //
      //     &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTsearch#POST_search.2Fjobs" target="test_blank"&gt;http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTsearch#POST_search.2Fjobs&lt;/A&gt;
      //EarliestTime = "-1w",
      //LatestTime = "now"
    };

    using (SearchResultStream resultStream = await service.SearchOneShotAsync(query, args: args))
    {
      foreach (SearchResult result in resultStream)
      {
        Console.WriteLine(result);
      }
    }
  }
  catch (Exception ex)
  {
    string strError = "";
    strError = ex.Message;
  }
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2017 21:27:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-SDK-API-Search-String-Syntax-Problem/m-p/323222#M4573</guid>
      <dc:creator>charles_corder</dc:creator>
      <dc:date>2017-12-06T21:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk SDK API Search String Syntax Problem</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-SDK-API-Search-String-Syntax-Problem/m-p/323223#M4574</link>
      <description>&lt;P&gt;Hi Charles,&lt;/P&gt;

&lt;P&gt;After creating the job with the API, you can go find it in the job activity to see if it ran as you expected.&lt;BR /&gt;
I would suggest you have a look at the User_Name field.&lt;/P&gt;

&lt;P&gt;Because of escaping you may be loosing a "\" in the User_Name you are looking for, therefore getting no results!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2017 10:29:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-SDK-API-Search-String-Syntax-Problem/m-p/323223#M4574</guid>
      <dc:creator>damien_chillet</dc:creator>
      <dc:date>2017-12-07T10:29:36Z</dc:date>
    </item>
  </channel>
</rss>

