<?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 Simple syntax to filter data by _raw value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183683#M52878</link>
    <description>&lt;P&gt;Hi all - I'm new here (literally an hour old) so go easy.&lt;/P&gt;

&lt;P&gt;I've read through parts of the docs and am currently using:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=crm index=main tag=error | eval kek = regex_raw = "foo@bar.com" | stats count by kek
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On data like:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;2015-01-16 13:00:19,747 [&lt;A href="mailto:foo@bar.com"&gt;foo@bar.com&lt;/A&gt;] ERROR jelly.fish.cake......&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;To try and play with data filtered by counting errors from particular usernames in the raw data like so.&lt;/P&gt;

&lt;P&gt;I'm almost there but get an error message about using eval on boolean data (the docs of which I've read); but which I've still yet to nail the syntax for.&lt;/P&gt;

&lt;P&gt;I've tried using rex, an if statement with eval (as suggested), tostring() (as suggested) and phrasing it differently like piping the data into the eval... but that simply pipes &lt;EM&gt;all&lt;/EM&gt; of the data rather than the usernames I'm interested in - and it seems like I just can't get the syntax right.&lt;/P&gt;

&lt;P&gt;Could you please tell me how I could filter data by the email address and count them like I'm trying?&lt;/P&gt;

&lt;P&gt;Thanks so much!!&lt;/P&gt;

&lt;P&gt;raz&lt;/P&gt;</description>
    <pubDate>Wed, 11 Mar 2015 19:14:24 GMT</pubDate>
    <dc:creator>razlani</dc:creator>
    <dc:date>2015-03-11T19:14:24Z</dc:date>
    <item>
      <title>Simple syntax to filter data by _raw value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183683#M52878</link>
      <description>&lt;P&gt;Hi all - I'm new here (literally an hour old) so go easy.&lt;/P&gt;

&lt;P&gt;I've read through parts of the docs and am currently using:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=crm index=main tag=error | eval kek = regex_raw = "foo@bar.com" | stats count by kek
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On data like:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;2015-01-16 13:00:19,747 [&lt;A href="mailto:foo@bar.com"&gt;foo@bar.com&lt;/A&gt;] ERROR jelly.fish.cake......&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;To try and play with data filtered by counting errors from particular usernames in the raw data like so.&lt;/P&gt;

&lt;P&gt;I'm almost there but get an error message about using eval on boolean data (the docs of which I've read); but which I've still yet to nail the syntax for.&lt;/P&gt;

&lt;P&gt;I've tried using rex, an if statement with eval (as suggested), tostring() (as suggested) and phrasing it differently like piping the data into the eval... but that simply pipes &lt;EM&gt;all&lt;/EM&gt; of the data rather than the usernames I'm interested in - and it seems like I just can't get the syntax right.&lt;/P&gt;

&lt;P&gt;Could you please tell me how I could filter data by the email address and count them like I'm trying?&lt;/P&gt;

&lt;P&gt;Thanks so much!!&lt;/P&gt;

&lt;P&gt;raz&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2015 19:14:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183683#M52878</guid>
      <dc:creator>razlani</dc:creator>
      <dc:date>2015-03-11T19:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Simple syntax to filter data by _raw value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183684#M52879</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;P&gt;Get count by email address&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=crm index=main tag=error |  rex "\[(?&amp;lt;kek&amp;gt;.[^\]]+)\]" | stats count by kek
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Mar 2015 19:53:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183684#M52879</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-03-11T19:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Simple syntax to filter data by _raw value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183685#M52880</link>
      <description>&lt;P&gt;Assuming you want to filter a single email address, your example could written something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=crm index=main tag=error "foo@bar.com" | stats count(_time)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This pulls all events from the main index where the host field has the value "crm", are tagged as "error", and contain "&lt;A href="mailto:foo@bar.com"&gt;foo@bar.com&lt;/A&gt;" somewhere in them.  It then counts the events found.&lt;/P&gt;

&lt;P&gt;Something more generic might be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=crm index=main tag=error | rex "\[(?P&amp;lt;addr&amp;gt;[^\]]+)\]" | stats count(_time) by addr
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Again, we're looking at all events from the main index where the host field has the value "crm" and are tagged as "error".  The &lt;CODE&gt;rex&lt;/CODE&gt; command extracts anything between square brackets from the _raw field (by default) and puts it into a field called "addr".  We then count each addr found.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2015 20:04:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183685#M52880</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-03-11T20:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Simple syntax to filter data by _raw value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183686#M52881</link>
      <description>&lt;P&gt;would make both answers correct if I could&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2015 22:34:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183686#M52881</guid>
      <dc:creator>razlani</dc:creator>
      <dc:date>2015-03-11T22:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Simple syntax to filter data by _raw value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183687#M52882</link>
      <description>&lt;P&gt;Thank you both!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2015 22:34:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-syntax-to-filter-data-by-raw-value/m-p/183687#M52882</guid>
      <dc:creator>razlani</dc:creator>
      <dc:date>2015-03-11T22:34:19Z</dc:date>
    </item>
  </channel>
</rss>

