<?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: Assigning a variable to field values consolidated by wildcard in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299535#M90253</link>
    <description>&lt;P&gt;To use wildcards in &lt;CODE&gt;eval&lt;/CODE&gt;, use the &lt;CODE&gt;match&lt;/CODE&gt; or &lt;CODE&gt;like&lt;/CODE&gt; function.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval dpInfo = if (match(url,"/api/v1/data/dataInfo/.*") | ...

... | eval dpInfo = if (like(url, "/api/v1/data/dataInfo/%") | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 31 Mar 2017 17:05:01 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2017-03-31T17:05:01Z</dc:date>
    <item>
      <title>Assigning a variable to field values consolidated by wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299534#M90252</link>
      <description>&lt;P&gt;I'm trying to wrap my head around assigning a variable to field values that have been consolidated by wildcard. The specific field is a url which contains unique values, but can be consolidated by wildcard:&lt;/P&gt;

&lt;P&gt;/api/v1/data/dataInfo/5034542340/0031f24ea10c/867542388&lt;BR /&gt;
/api/v1/data/dataInfo/6134191727/0031f24ea10c/1353781841&lt;BR /&gt;
/api/v1/data/validate&lt;/P&gt;

&lt;P&gt;Each of these has statusCode, timestamp, etc fields associated. I am needing to do a count of how many times /api/v1/data/dataInfo/* had a 404 response, and how many times  /api/v1/data/validate had a 404 response, ideally in a timechart. Without consolidating to a wildcard, I have hundreds of results, because the hash that I'm consolidating via wildcard is unique.&lt;/P&gt;

&lt;P&gt;I've tried the following, but it errors on "Error in 'eval' command: The expression is malformed. An unexpected character is reached at '/api/v1/data/dataInfo/*)'." I take this to mean I can't use eval/if with a wildcard. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=data_index environment=Production clientName="DataTool" statusCode=404
| eval dpInfo = if(url=/api/v1/data/dataInfo/*) 
| eval validate = if(url=/api/v1/data/validate) 
| timechart count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any ideas would be very much appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 16:41:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299534#M90252</guid>
      <dc:creator>smutherbavaro</dc:creator>
      <dc:date>2017-03-31T16:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning a variable to field values consolidated by wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299535#M90253</link>
      <description>&lt;P&gt;To use wildcards in &lt;CODE&gt;eval&lt;/CODE&gt;, use the &lt;CODE&gt;match&lt;/CODE&gt; or &lt;CODE&gt;like&lt;/CODE&gt; function.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval dpInfo = if (match(url,"/api/v1/data/dataInfo/.*") | ...

... | eval dpInfo = if (like(url, "/api/v1/data/dataInfo/%") | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Mar 2017 17:05:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299535#M90253</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-03-31T17:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning a variable to field values consolidated by wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299536#M90254</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=data_index environment=Production clientName="DataTool" statusCode=404
| timechart count(eval(match(url, "^/api/v1/data/dataInfo/"))) AS dpinvo
            count(eval(match(url, "^/api/v1/data/validate$"))) AS validate
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Mar 2017 22:19:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299536#M90254</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-31T22:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning a variable to field values consolidated by wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299537#M90255</link>
      <description>&lt;P&gt;Is it &lt;CODE&gt;*&lt;/CODE&gt; or &lt;CODE&gt;.*&lt;/CODE&gt; or &lt;CODE&gt;%&lt;/CODE&gt; in  the context of &lt;CODE&gt;match&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 22:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299537#M90255</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-31T22:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning a variable to field values consolidated by wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299538#M90256</link>
      <description>&lt;P&gt;Good point; I should not have had the &lt;CODE&gt;*&lt;/CODE&gt; there at all (I modified my answer).  I could have put in &lt;CODE&gt;.*&lt;/CODE&gt; but it would have been redundant for the need and waste effort for the RegEx parser. &lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 23:30:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Assigning-a-variable-to-field-values-consolidated-by-wildcard/m-p/299538#M90256</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-31T23:30:35Z</dc:date>
    </item>
  </channel>
</rss>

