<?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 aggregate several similar fields into one and tabulate top values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-aggregate-several-similar-fields-into-one-and-tabulate/m-p/178938#M51492</link>
    <description>&lt;P&gt;Solid. &lt;/P&gt;

&lt;P&gt;Yeah - at most one credit card number per event, so this works quite well. Thanks for the help!&lt;/P&gt;</description>
    <pubDate>Tue, 17 Mar 2015 21:59:17 GMT</pubDate>
    <dc:creator>shantu</dc:creator>
    <dc:date>2015-03-17T21:59:17Z</dc:date>
    <item>
      <title>How to aggregate several similar fields into one and tabulate top values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-aggregate-several-similar-fields-into-one-and-tabulate/m-p/178936#M51490</link>
      <description>&lt;P&gt;I have created several search-time field extractions to filter out Credit Card numbers from our logs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\s+(?&amp;lt;CCVisaNumber&amp;gt;4[0-9]{12}(?:[0-9]{3})?)
\s+(?&amp;lt;CCMasterCardNumber&amp;gt;5[1-5][0-9]{14})
\s+(?&amp;lt;CCJCBNumber&amp;gt;(?:2131|1800|35\d{3})\d{11})
\s+(?&amp;lt;CCAmexNumber&amp;gt;3[47][0-9]{13})
\s+(?&amp;lt;CCDinersNumber&amp;gt;3(?:0[0-5]|[68][0-9])[0-9]{11})
\s+(?&amp;lt;CCDiscoverNumber&amp;gt;6(?:011|5[0-9]{2})[0-9]{12})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would ideally like to aggregate all of these in one field "CreditCardNumber" so that I can then use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=stagexx | top CreditCardNumber
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(Essentially, I want to display them in descending order of frequency)&lt;/P&gt;

&lt;P&gt;Is there any way to do that? The &lt;CODE&gt;rex&lt;/CODE&gt; command doesn't support this sort of OR use case (using &lt;CODE&gt;|&lt;/CODE&gt; with quotes et al proved futile). &lt;/P&gt;

&lt;P&gt;Instead, could I perhaps aggregate these into one field while trying to create a table? Something like assigning all of them to one &lt;CODE&gt;type&lt;/CODE&gt; of sorts (such as &lt;CODE&gt;CreditCardNumber&lt;/CODE&gt;) and then displaying all values in descending order of frequency?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2015 21:48:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-aggregate-several-similar-fields-into-one-and-tabulate/m-p/178936#M51490</guid>
      <dc:creator>shantu</dc:creator>
      <dc:date>2015-03-17T21:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to aggregate several similar fields into one and tabulate top values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-aggregate-several-similar-fields-into-one-and-tabulate/m-p/178937#M51491</link>
      <description>&lt;P&gt;You want to use the &lt;CODE&gt;coalesce&lt;/CODE&gt; function of the &lt;CODE&gt;eval&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...all your extractions... 
| eval CCNumber=coalesce(CCVisaNumber,CCMasterCardNumber,CCJCBNumber,CCAmexNumber,CCDinersNumber,CCDiscoverNumber)
| top CCNumber
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(This will only work if you only have one credit card number per event, though. If you have more than one per event, you'll need fancier footwork than this.)&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2015 21:55:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-aggregate-several-similar-fields-into-one-and-tabulate/m-p/178937#M51491</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2015-03-17T21:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to aggregate several similar fields into one and tabulate top values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-aggregate-several-similar-fields-into-one-and-tabulate/m-p/178938#M51492</link>
      <description>&lt;P&gt;Solid. &lt;/P&gt;

&lt;P&gt;Yeah - at most one credit card number per event, so this works quite well. Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2015 21:59:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-aggregate-several-similar-fields-into-one-and-tabulate/m-p/178938#M51492</guid>
      <dc:creator>shantu</dc:creator>
      <dc:date>2015-03-17T21:59:17Z</dc:date>
    </item>
  </channel>
</rss>

