<?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: 'SearchParser': Missing a search command before '^' in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/SearchParser-Missing-a-search-command-before/m-p/496325#M138312</link>
    <description>&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field=_raw "Environment\=+\\\+\"(?&amp;lt;env&amp;gt;.*?)\\\\+\"+\,+\s+Service\=+\\\+\"(?&amp;lt;serv&amp;gt;.*?)\\\\"|table env,serv
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 04 Dec 2019 08:25:18 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2019-12-04T08:25:18Z</dc:date>
    <item>
      <title>'SearchParser': Missing a search command before '^'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SearchParser-Missing-a-search-command-before/m-p/496323#M138310</link>
      <description>&lt;P&gt;I am trying to extract fields Environment and Service with below search and receiving the error 'SearchParser': Missing a search command before '^'.&lt;BR /&gt;
I got the rex command from Splunk field extractor screen, however, this error comes up in the search window.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=***  base search    |  rex field=message "^[^\\\n]*\\"(?P&amp;lt;Environment&amp;gt;[^\\]+)[^=\n]*=\\"(?P&amp;lt;Service&amp;gt;[^\\]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{ "__CURSOR" : "s=ccf7ccd2666b481c880c3a36c2d0d504;i=71c1b4;b=423aef85e8a745d785e26ea9b1611d92;m=9cd3993341;t=598cb4887fb24;x=29d41973a54be13c", "__REALTIME_TIMESTAMP" : "1575373746207524", "__MONOTONIC_TIMESTAMP" : "673564930881", "_BOOT_ID" : "423aef85e8a745d785e26ea9b1611d92", "_UID" : "0", "_GID" : "0", "_CAP_EFFECTIVE" : "1fffffffff", "_SYSTEMD_SLICE" : "system.slice", "_MACHINE_ID" : "6be70c13152f40488b5f3b3847dc2bd0", "_HOSTNAME" : "ocf-splunk-nonprod-linux-1", "_TRANSPORT" : "stdout", "PRIORITY" : "6", "_STREAM_ID" : "f5dbc3d1330f4783bf0586cfaad9a4fc", "SYSLOG_IDENTIFIER" : "polling_url.sh", "_PID" : "2345", "_COMM" : "cat", "_EXE" : "/usr/bin/cat", "_CMDLINE" : "/bin/cat", "_AUDIT_SESSION" : "8872", "_AUDIT_LOGINUID" : "0", "_SYSTEMD_CGROUP" : "/system.slice/crond.service", "_SYSTEMD_UNIT" : "crond.service", "MESSAGE" : "2019-12-03 05:49:05, Environment=\"OTS STRESS(CDC)\", Service=\"services-orderdetails-stress.apps.cdc-b.lle.xpaas.kohls\", WSDL_Service=\"KohlsOrderService\", Status=404, Response_Time=0.244, Endpoint=\"https://oms-services-orderdetails-stress.apps.cdc-b.lle.xpaas.kohls.com/ots_orderstatus/KohlsOrderService?wsdl\"" }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 16:19:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SearchParser-Missing-a-search-command-before/m-p/496323#M138310</guid>
      <dc:creator>maria_n</dc:creator>
      <dc:date>2019-12-03T16:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: 'SearchParser': Missing a search command before '^'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SearchParser-Missing-a-search-command-before/m-p/496324#M138311</link>
      <description>&lt;P&gt;can you specify what fields you are trying to extract from the sample event?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 08:14:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SearchParser-Missing-a-search-command-before/m-p/496324#M138311</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-12-04T08:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: 'SearchParser': Missing a search command before '^'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SearchParser-Missing-a-search-command-before/m-p/496325#M138312</link>
      <description>&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field=_raw "Environment\=+\\\+\"(?&amp;lt;env&amp;gt;.*?)\\\\+\"+\,+\s+Service\=+\\\+\"(?&amp;lt;serv&amp;gt;.*?)\\\\"|table env,serv
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2019 08:25:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SearchParser-Missing-a-search-command-before/m-p/496325#M138312</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-12-04T08:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: 'SearchParser': Missing a search command before '^'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SearchParser-Missing-a-search-command-before/m-p/496326#M138313</link>
      <description>&lt;P&gt;NEVER let splunk build RegEx OR pick timestamps.  Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{ \"__CURSOR\" : \"s=ccf7ccd2666b481c880c3a36c2d0d504;i=71c1b4;b=423aef85e8a745d785e26ea9b1611d92;m=9cd3993341;t=598cb4887fb24;x=29d41973a54be13c\", \"__REALTIME_TIMESTAMP\" : \"1575373746207524\", \"__MONOTONIC_TIMESTAMP\" : \"673564930881\", \"_BOOT_ID\" : \"423aef85e8a745d785e26ea9b1611d92\", \"_UID\" : \"0\", \"_GID\" : \"0\", \"_CAP_EFFECTIVE\" : \"1fffffffff\", \"_SYSTEMD_SLICE\" : \"system.slice\", \"_MACHINE_ID\" : \"6be70c13152f40488b5f3b3847dc2bd0\", \"_HOSTNAME\" : \"ocf-splunk-nonprod-linux-1\", \"_TRANSPORT\" : \"stdout\", \"PRIORITY\" : \"6\", \"_STREAM_ID\" : \"f5dbc3d1330f4783bf0586cfaad9a4fc\", \"SYSLOG_IDENTIFIER\" : \"polling_url.sh\", \"_PID\" : \"2345\", \"_COMM\" : \"cat\", \"_EXE\" : \"/usr/bin/cat\", \"_CMDLINE\" : \"/bin/cat\", \"_AUDIT_SESSION\" : \"8872\", \"_AUDIT_LOGINUID\" : \"0\", \"_SYSTEMD_CGROUP\" : \"/system.slice/crond.service\", \"_SYSTEMD_UNIT\" : \"crond.service\", \"MESSAGE\" : \"2019-12-03 05:49:05, Environment=\\\"OTS STRESS(CDC)\\\", Service=\\\"services-orderdetails-stress.apps.cdc-b.lle.xpaas.kohls\\\", WSDL_Service=\\\"KohlsOrderService\\\", Status=404, Response_Time=0.244, Endpoint=\\\"" 
| spath 
| rex "\\\"MESSAGE\\\"\s*:\s*\\\"(?&amp;lt;message&amp;gt;.*)" 
| rex field=message "Environment=\\\\\\\"(?&amp;lt;Environment&amp;gt;[^\\\]+)\S+\s+Service=\\\\\\\"(?&amp;lt;Service&amp;gt;[^\\\]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2019 10:03:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SearchParser-Missing-a-search-command-before/m-p/496326#M138313</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-04T10:03:46Z</dc:date>
    </item>
  </channel>
</rss>

