<?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 REST API | Validate SPL in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-REST-API-Validate-SPL/m-p/593355#M10304</link>
    <description>&lt;P&gt;You can use /services/search/parser to validate SPL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;smcmaster@splunk ~ % curl -s -k -u admin:***** -d output_mode=json -d q="search index=foo sourcetype=bar" https://localhost:8089/services/search/parser | jq .
{
  "remoteSearch": "litsearch (index=foo sourcetype=bar) | fields  keepcolorder=t \"_bkt\" \"_cd\" \"_si\" \"host\" \"index\" \"linecount\" \"source\" \"sourcetype\" \"splunk_server\"",
  "normalizedSearch": "litsearch (index=foo sourcetype=bar) | fields keepcolorder=t \"_bkt\" \"_cd\" \"_si\" \"host\" \"index\" \"linecount\" \"source\" \"sourcetype\" \"splunk_server\"",
  "remoteTimeOrdered": true,
  "eventsSearch": "search index=foo sourcetype=bar",
  "eventsTimeOrdered": true,
  "eventsStreaming": true,
  "reportsSearch": "",
  "isStreamingSearch": true,
  "canSummarize": false,
  "commands": [
    {
      "command": "search",
      "rawargs": "index=foo sourcetype=bar",
      "pipeline": "streaming",
      "args": {
        "search": [
          "(index=foo sourcetype=bar)"
        ]
      },
      "isGenerating": true,
      "streamType": "SP_STREAM"
    }
  ]
}
smcmaster@splunk ~ % curl -s -k -u admin:***** -d output_mode=json -d q="search index=foo sourcetype=bar | bizzbuzz" https://localhost:8089/services/search/parser | jq .
{
  "messages": [
    {
      "type": "FATAL",
      "text": "Unknown search command 'bizzbuzz'."
    }
  ]
}
smcmaster@splunk ~ %&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Successful parsing (such as the first example) results in 200, failure (such as the second example) results in a 400.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2022 20:57:11 GMT</pubDate>
    <dc:creator>mcmaster</dc:creator>
    <dc:date>2022-04-11T20:57:11Z</dc:date>
    <item>
      <title>Splunk REST API | Validate SPL</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-REST-API-Validate-SPL/m-p/582098#M10303</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am working on a project that take SPL input from user. So, i need to be sure that SPL has a correct syntax without making a search with the SPL. I could not see but is there a validator for SPLs?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 22:18:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-REST-API-Validate-SPL/m-p/582098#M10303</guid>
      <dc:creator>kirchoff</dc:creator>
      <dc:date>2022-01-21T22:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk REST API | Validate SPL</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-REST-API-Validate-SPL/m-p/593355#M10304</link>
      <description>&lt;P&gt;You can use /services/search/parser to validate SPL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;smcmaster@splunk ~ % curl -s -k -u admin:***** -d output_mode=json -d q="search index=foo sourcetype=bar" https://localhost:8089/services/search/parser | jq .
{
  "remoteSearch": "litsearch (index=foo sourcetype=bar) | fields  keepcolorder=t \"_bkt\" \"_cd\" \"_si\" \"host\" \"index\" \"linecount\" \"source\" \"sourcetype\" \"splunk_server\"",
  "normalizedSearch": "litsearch (index=foo sourcetype=bar) | fields keepcolorder=t \"_bkt\" \"_cd\" \"_si\" \"host\" \"index\" \"linecount\" \"source\" \"sourcetype\" \"splunk_server\"",
  "remoteTimeOrdered": true,
  "eventsSearch": "search index=foo sourcetype=bar",
  "eventsTimeOrdered": true,
  "eventsStreaming": true,
  "reportsSearch": "",
  "isStreamingSearch": true,
  "canSummarize": false,
  "commands": [
    {
      "command": "search",
      "rawargs": "index=foo sourcetype=bar",
      "pipeline": "streaming",
      "args": {
        "search": [
          "(index=foo sourcetype=bar)"
        ]
      },
      "isGenerating": true,
      "streamType": "SP_STREAM"
    }
  ]
}
smcmaster@splunk ~ % curl -s -k -u admin:***** -d output_mode=json -d q="search index=foo sourcetype=bar | bizzbuzz" https://localhost:8089/services/search/parser | jq .
{
  "messages": [
    {
      "type": "FATAL",
      "text": "Unknown search command 'bizzbuzz'."
    }
  ]
}
smcmaster@splunk ~ %&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Successful parsing (such as the first example) results in 200, failure (such as the second example) results in a 400.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 20:57:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-REST-API-Validate-SPL/m-p/593355#M10304</guid>
      <dc:creator>mcmaster</dc:creator>
      <dc:date>2022-04-11T20:57:11Z</dc:date>
    </item>
  </channel>
</rss>

