<?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: Unable to get count when variable names has a  &amp;quot;-&amp;quot; in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414205#M167832</link>
    <description>&lt;P&gt;Like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... rename *-* AS ** ... | stats count by OrderType
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 20 Aug 2018 17:56:12 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2018-08-20T17:56:12Z</dc:date>
    <item>
      <title>Unable to get count when variable names has a  "-"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414200#M167827</link>
      <description>&lt;P&gt;One of the queries i'm using has a variable with a "-" and splunk is unable to get me the stats count using the variable. &lt;/P&gt;

&lt;P&gt;Example : your search | stats count by Order-Type&lt;/P&gt;

&lt;P&gt;Is there a limitation on the variable names to be used in splunk?&lt;/P&gt;

&lt;P&gt;Note: I did get the final result by using regex. &lt;BR /&gt;
Example: your search | rex field=&lt;EM&gt;raw "Order-Type=(?[\"A-Z&lt;/EM&gt; ]+)" | stats count by type&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 01:46:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414200#M167827</guid>
      <dc:creator>vjzone</dc:creator>
      <dc:date>2018-08-17T01:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get count when variable names has a  "-"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414201#M167828</link>
      <description>&lt;P&gt;The &lt;CODE&gt;stats&lt;/CODE&gt; command is probably trying to subtract field 'Type' from field 'Order' and is failing because neither field exists.  Try one of the following:&lt;/P&gt;

&lt;P&gt;1) &lt;CODE&gt;... | stats count by 'Order-Type'&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;2) &lt;CODE&gt;... | rename "Order-Type" as OrderType | stats count by OrderType | rename OrderType as "Order-Type"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;3) Use a different field name without a hyphen in it.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 11:32:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414201#M167828</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-08-17T11:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get count when variable names has a  "-"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414202#M167829</link>
      <description>&lt;P&gt;I have already tried #1 and #2, but that doesn't seem to work. #3 is not an option without a code change and i do not want to take that route.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 16:14:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414202#M167829</guid>
      <dc:creator>vjzone</dc:creator>
      <dc:date>2018-08-17T16:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get count when variable names has a  "-"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414203#M167830</link>
      <description>&lt;P&gt;Updated the example: your search | rex field=raw "Order-Type=(?[\"A-Z ]+)" | stats count by type&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 17:02:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414203#M167830</guid>
      <dc:creator>vjzone</dc:creator>
      <dc:date>2018-08-17T17:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get count when variable names has a  "-"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414204#M167831</link>
      <description>&lt;P&gt;I did try to replicate the same scenario and for me its working fine without any issues. If you are not getting the desired results using @richgalloway`s response, try creating a new filed for Order-Type using the below command.&lt;BR /&gt;
|eval OrderType='Order-Type'&lt;BR /&gt;
|stats count by OrderType&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 22:19:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414204#M167831</guid>
      <dc:creator>nadlurinadluri</dc:creator>
      <dc:date>2018-08-17T22:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get count when variable names has a  "-"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414205#M167832</link>
      <description>&lt;P&gt;Like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... rename *-* AS ** ... | stats count by OrderType
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Aug 2018 17:56:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414205#M167832</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-08-20T17:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get count when variable names has a  "-"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414206#M167833</link>
      <description>&lt;P&gt;This is weird. I can no longer do a stats count by with variables separated by -. I think i was able to do this earlier. Is there something s Splunk admin could do to disable this?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 01:01:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414206#M167833</guid>
      <dc:creator>vjzone</dc:creator>
      <dc:date>2018-08-22T01:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get count when variable names has a  "-"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414207#M167834</link>
      <description>&lt;P&gt;I got the answer after talking to a friend. Splunk parsed the field Order-Type as Order_Type(listed in interesting fields of verbose mode).&lt;/P&gt;

&lt;P&gt;All i needed to do was "your search | stats count by Order_Type"&lt;/P&gt;

&lt;P&gt;Thanks guys!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 23:36:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414207#M167834</guid>
      <dc:creator>vjzone</dc:creator>
      <dc:date>2018-08-22T23:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get count when variable names has a  "-"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414208#M167835</link>
      <description>&lt;P&gt;Right!! thats actually true, splunk converts '-' to '_' at the time of ingestion.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 23:41:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-count-when-variable-names-has-a-quot-quot/m-p/414208#M167835</guid>
      <dc:creator>nadlurinadluri</dc:creator>
      <dc:date>2018-08-22T23:41:25Z</dc:date>
    </item>
  </channel>
</rss>

