<?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 I sum 2 field extractions if only one field extraction exists per log? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145635#M40624</link>
    <description>&lt;P&gt;Hi wpreston. Thanks for the comment, however it doesn't seem to be working. It returns each currency in one column but the CurrencyCount is 0 for each currency. Any other ideas are welcome!&lt;/P&gt;</description>
    <pubDate>Fri, 05 Dec 2014 13:26:55 GMT</pubDate>
    <dc:creator>philallen1</dc:creator>
    <dc:date>2014-12-05T13:26:55Z</dc:date>
    <item>
      <title>How do I sum 2 field extractions if only one field extraction exists per log?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145633#M40622</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;So I've used Field Extractions to name 2 different fields in my logs: "dealtCurrency" and "dealtCurrencyDefault". &lt;/P&gt;

&lt;P&gt;The dealtCurrencyDefault field will ALWAYS appear in my logs. However, the dealtCurrency field appears only in some logs. When the dealtCurrency appears, my regex ignores the dealtCurrencyDefault field altogether. So, my regex only ever gives me one field back - dealtCurrencyDefault (if there is no dealtCurrency), and dealtCurrency (if there is dealtCurrency).&lt;/P&gt;

&lt;P&gt;I'm now trying to create a chart that displays the "currency" along the x axis and the "number of occurrences" along the y axis.&lt;/P&gt;

&lt;P&gt;How can I write a search query that creates this chart? &lt;/P&gt;

&lt;P&gt;I've tried things along the lines of:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eval currency=coalesce(dealtCurrency,dealtCurrencyDefault)
   | chart sum(currency ) as suma by currency 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gives me all the currencies, but it doesn't sum them to create the "number of occurrences" field (I just get empty field for the suma column).&lt;/P&gt;

&lt;P&gt;Any ideas? Should I be using 'buckets'? Not really sure how to use them...&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;(Also not sure if the title is accurately describing this - so please feel free to suggest a more suitable one)&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2014 10:36:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145633#M40622</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2014-12-05T10:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sum 2 field extractions if only one field extraction exists per log?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145634#M40623</link>
      <description>&lt;P&gt;Have you tried using &lt;CODE&gt;count&lt;/CODE&gt; instead of &lt;CODE&gt;sum&lt;/CODE&gt;?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eval currency=coalesce(dealtCurrency,dealtCurrencyDefault)
| chart count(currency) as CurrencyCount by currency
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Dec 2014 13:15:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145634#M40623</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2014-12-05T13:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sum 2 field extractions if only one field extraction exists per log?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145635#M40624</link>
      <description>&lt;P&gt;Hi wpreston. Thanks for the comment, however it doesn't seem to be working. It returns each currency in one column but the CurrencyCount is 0 for each currency. Any other ideas are welcome!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2014 13:26:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145635#M40624</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2014-12-05T13:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sum 2 field extractions if only one field extraction exists per log?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145636#M40625</link>
      <description>&lt;P&gt;Can  you share the rest of your search?  &lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2014 13:32:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145636#M40625</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2014-12-05T13:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sum 2 field extractions if only one field extraction exists per log?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145637#M40626</link>
      <description>&lt;P&gt;Hey wpreston&lt;/P&gt;

&lt;P&gt;Acutally, it has randomly decided to work! (No idea what made it work - Splunk seems to be quite temperamental). So this is my final query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eval currency=coalesce(dealtCurrency,dealtCurrencyDefault) | chart count(currency) as CurrencyCount by currency
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks a lot for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2014 13:36:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145637#M40626</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2014-12-05T13:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sum 2 field extractions if only one field extraction exists per log?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145638#M40627</link>
      <description>&lt;P&gt;You're very welcome, glad it worked for you!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2014 13:38:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sum-2-field-extractions-if-only-one-field-extraction/m-p/145638#M40627</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2014-12-05T13:38:55Z</dc:date>
    </item>
  </channel>
</rss>

