<?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: How do you use multi value tags in eval? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-multi-value-tags-in-eval/m-p/23879#M4298</link>
    <description>&lt;P&gt;Very belated answer, but helpful for those who may end up here by search...&lt;/P&gt;

&lt;P&gt;Instead of "tag::host", try single quote:&lt;BR /&gt;
* | eval nr_tags=mvcount('tag::host')&lt;/P&gt;

&lt;P&gt;Try this and compare the results. Set up more than one tag on at least one host so you can compare:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | eval foo="tag::host"
   | tags outputfield=bar host
   | eval bar2='tag::host'
   | eval baz=mvcount("tag::host")
   | eval buz=mvcount('tag::host')
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 06 Sep 2014 23:33:44 GMT</pubDate>
    <dc:creator>bob_kerns</dc:creator>
    <dc:date>2014-09-06T23:33:44Z</dc:date>
    <item>
      <title>How do you use multi value tags in eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-multi-value-tags-in-eval/m-p/23877#M4296</link>
      <description>&lt;P&gt;I getting an eval error when I'm trying to use eval on a host tag.&lt;BR /&gt;
"Error in 'eval' command: The expression is malformed. Expected )"&lt;/P&gt;

&lt;P&gt;Most hosts have more than on tag.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | eval nr_tags=eval(mvcount(tag::host))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jun 2011 09:34:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-multi-value-tags-in-eval/m-p/23877#M4296</guid>
      <dc:creator>Marinus</dc:creator>
      <dc:date>2011-06-07T09:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use multi value tags in eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-multi-value-tags-in-eval/m-p/23878#M4297</link>
      <description>&lt;P&gt;Hi I have a similar problem.&lt;/P&gt;

&lt;P&gt;the thing is even with &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | eval nr_tags=mvcount("tag::host")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you will always get 1 in nr_tags. it takes this as a string. &lt;/P&gt;

&lt;P&gt;I would like to do something like this:&lt;/P&gt;

&lt;P&gt;|&amp;nbsp;eval iscool=if("tag::host" == "cool", "yes" , "no")&lt;/P&gt;

&lt;P&gt;where host=fridge with tags: cool, fridge, .. &lt;/P&gt;

&lt;P&gt;So actually i want to have a field in case a certain tag is applied to this event.&lt;BR /&gt;
But i strugle to identify this in the tag::host field. mvcount and so always sees "tag::host" as a string, not as the field&lt;/P&gt;

&lt;P&gt;Any Ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2013 09:52:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-multi-value-tags-in-eval/m-p/23878#M4297</guid>
      <dc:creator>msenebald</dc:creator>
      <dc:date>2013-06-19T09:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use multi value tags in eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-multi-value-tags-in-eval/m-p/23879#M4298</link>
      <description>&lt;P&gt;Very belated answer, but helpful for those who may end up here by search...&lt;/P&gt;

&lt;P&gt;Instead of "tag::host", try single quote:&lt;BR /&gt;
* | eval nr_tags=mvcount('tag::host')&lt;/P&gt;

&lt;P&gt;Try this and compare the results. Set up more than one tag on at least one host so you can compare:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | eval foo="tag::host"
   | tags outputfield=bar host
   | eval bar2='tag::host'
   | eval baz=mvcount("tag::host")
   | eval buz=mvcount('tag::host')
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 06 Sep 2014 23:33:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-multi-value-tags-in-eval/m-p/23879#M4298</guid>
      <dc:creator>bob_kerns</dc:creator>
      <dc:date>2014-09-06T23:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use multi value tags in eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-multi-value-tags-in-eval/m-p/23880#M4299</link>
      <description>&lt;P&gt;Note, however, that this won't work in a computed field, since tagging happens after field extraction (including computed fields).&lt;/P&gt;</description>
      <pubDate>Sun, 07 Sep 2014 00:19:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-multi-value-tags-in-eval/m-p/23880#M4299</guid>
      <dc:creator>bob_kerns</dc:creator>
      <dc:date>2014-09-07T00:19:22Z</dc:date>
    </item>
  </channel>
</rss>

