<?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 How do I rename and extract multiple data from a search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-and-extract-multiple-data-from-a-search/m-p/218146#M64125</link>
    <description>&lt;P&gt;I have log lines of the form (relevant excerpt only, they contain also hostname, timestamp, etc):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;data_name: A B C D E
data_name: A
data_name: A C D
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;basically, data_name is a collection of strings in a set that may or may not be present for a particular log line.&lt;/P&gt;

&lt;P&gt;I want to extract several things:&lt;BR /&gt;
1) the entries that have A&lt;BR /&gt;
2) the entries that have A but not C in the same line&lt;BR /&gt;
3) all possible entries&lt;/P&gt;

&lt;P&gt;and display their count (and e.g. hostname) in a chart.&lt;/P&gt;

&lt;P&gt;I've tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( data_name AND A ) OR ( data_name AND A NOT B ) | dedup host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but this gives me results that are not distinguishable. How can I rename the first predicate (left of OR) so I can apply a "count" to it, and do the same for the second predicate (right of OR) and the third, and the fourth, etc.&lt;BR /&gt;
Is this the right approach? &lt;/P&gt;</description>
    <pubDate>Fri, 30 Sep 2016 17:34:35 GMT</pubDate>
    <dc:creator>virgilg</dc:creator>
    <dc:date>2016-09-30T17:34:35Z</dc:date>
    <item>
      <title>How do I rename and extract multiple data from a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-and-extract-multiple-data-from-a-search/m-p/218146#M64125</link>
      <description>&lt;P&gt;I have log lines of the form (relevant excerpt only, they contain also hostname, timestamp, etc):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;data_name: A B C D E
data_name: A
data_name: A C D
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;basically, data_name is a collection of strings in a set that may or may not be present for a particular log line.&lt;/P&gt;

&lt;P&gt;I want to extract several things:&lt;BR /&gt;
1) the entries that have A&lt;BR /&gt;
2) the entries that have A but not C in the same line&lt;BR /&gt;
3) all possible entries&lt;/P&gt;

&lt;P&gt;and display their count (and e.g. hostname) in a chart.&lt;/P&gt;

&lt;P&gt;I've tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( data_name AND A ) OR ( data_name AND A NOT B ) | dedup host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but this gives me results that are not distinguishable. How can I rename the first predicate (left of OR) so I can apply a "count" to it, and do the same for the second predicate (right of OR) and the third, and the fourth, etc.&lt;BR /&gt;
Is this the right approach? &lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 17:34:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-and-extract-multiple-data-from-a-search/m-p/218146#M64125</guid>
      <dc:creator>virgilg</dc:creator>
      <dc:date>2016-09-30T17:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I rename and extract multiple data from a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-and-extract-multiple-data-from-a-search/m-p/218147#M64126</link>
      <description>&lt;P&gt;Try this (you will need to adjust the regex)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | rex "data_name\:\s(?&amp;lt;data_name&amp;gt;.*) | eval OnlyA=if(match(data_name, "\bA\b"), 1, 0) | eval A_No_C=if(match(data_name, "\bA\b" AND NOT match(data_name, "\bC\b"), 1, 0) | stats count sum(OnlyA) as OnlyA sum(A_No_C) as A_No_C
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Sep 2016 18:41:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-and-extract-multiple-data-from-a-search/m-p/218147#M64126</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-30T18:41:56Z</dc:date>
    </item>
  </channel>
</rss>

