<?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 to count field with string and empty string and draw a chart ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-field-with-string-and-empty-string-and-draw-a-chart/m-p/133195#M184633</link>
    <description>&lt;P&gt;You can try something like this:&lt;/P&gt;

&lt;P&gt;| rex "email=(?&lt;EMAIL&gt;[^\,]*)"  | eval emailtype = if(email==" ","Anonymous","Customer") | stats count by emailtype&lt;/EMAIL&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Apr 2014 11:44:26 GMT</pubDate>
    <dc:creator>adityapavan18</dc:creator>
    <dc:date>2014-04-16T11:44:26Z</dc:date>
    <item>
      <title>How to count field with string and empty string and draw a chart ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-field-with-string-and-empty-string-and-draw-a-chart/m-p/133194#M184632</link>
      <description>&lt;P&gt;I have below format of data. I would like to count email with empty string as anonymous and email with any string as customer and would like to draw a chart for the same.&lt;BR /&gt;
email= ,status='yes'&lt;BR /&gt;
email=&lt;A href="mailto:abced@gmail.com"&gt;abced@gmail.com&lt;/A&gt; ,status='yes'&lt;BR /&gt;
email=&lt;A href="mailto:ced@gmail.com"&gt;ced@gmail.com&lt;/A&gt; ,status='yes'&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2014 10:56:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-field-with-string-and-empty-string-and-draw-a-chart/m-p/133194#M184632</guid>
      <dc:creator>annalwins</dc:creator>
      <dc:date>2014-04-16T10:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to count field with string and empty string and draw a chart ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-field-with-string-and-empty-string-and-draw-a-chart/m-p/133195#M184633</link>
      <description>&lt;P&gt;You can try something like this:&lt;/P&gt;

&lt;P&gt;| rex "email=(?&lt;EMAIL&gt;[^\,]*)"  | eval emailtype = if(email==" ","Anonymous","Customer") | stats count by emailtype&lt;/EMAIL&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2014 11:44:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-field-with-string-and-empty-string-and-draw-a-chart/m-p/133195#M184633</guid>
      <dc:creator>adityapavan18</dc:creator>
      <dc:date>2014-04-16T11:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to count field with string and empty string and draw a chart ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-field-with-string-and-empty-string-and-draw-a-chart/m-p/133196#M184634</link>
      <description>&lt;P&gt;It works as I expected. &lt;BR /&gt;
[1] Can you explain me about this rex. How does email="" string goes to Anonymous and email=äbcd.gmail.com goes to customer?&lt;BR /&gt;
[2] How can I get avg customer from this ?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2014 09:41:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-field-with-string-and-empty-string-and-draw-a-chart/m-p/133196#M184634</guid>
      <dc:creator>annalwins</dc:creator>
      <dc:date>2014-04-17T09:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to count field with string and empty string and draw a chart ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-field-with-string-and-empty-string-and-draw-a-chart/m-p/133197#M184635</link>
      <description>&lt;P&gt;Its simple, the rex i mentioned extracts everything between the string "email=" and the comma(,).&lt;BR /&gt;
In case of proper email id's it extract email id's, but when there is no email Id there is only a blank space and that is extracted.&lt;BR /&gt;
Now in my eval statement i am checking if email value is a blank space if yes i am setting a variable emailtype as Anonymous else as Customer. Hope that helps.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2014 09:56:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-field-with-string-and-empty-string-and-draw-a-chart/m-p/133197#M184635</guid>
      <dc:creator>adityapavan18</dc:creator>
      <dc:date>2014-04-17T09:56:31Z</dc:date>
    </item>
  </channel>
</rss>

