<?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 Compare todays data with yesterdays for results from a custom command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488842#M136529</link>
    <description>&lt;P&gt;I have a custom command that returns results in tabular format with a _time column as well.&lt;/P&gt;

&lt;P&gt;Its something like below&lt;/P&gt;

&lt;P&gt;| &lt;STRONG&gt;dyntapplications&lt;/STRONG&gt; dynt_server=psg-dynatrace-qa.abc.com | search name=* | map search="| &lt;EM&gt;dyntmetricdata&lt;/EM&gt; dynt_server=psg-dynatrace-qa.abc.com application=$name$ metric_path=\"Application Infrastructure Performance|*|Agent|Agent Channels|App Config Poll\" earliest=-1d@d latest=@d  "&lt;/P&gt;

&lt;P&gt;time                    application                dynt_server                            count current frequency   sum&lt;BR /&gt;
4/28/2020 0:00  PBM-Analytics-UAT   psg-dynatrace-qa.abc.com          20    11          TEN_MIN 7&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
4/28/2020 23:00 PBM-Analytics-UAT   psg-dynatrace-qa.abc.com          20    11          TEN_MIN 78&lt;BR /&gt;
4/28/2020 0:10  APM-Analytics               psg-dynatrace-qa.abc.com      23    14          TEN_MIN 77&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
4/28/2020 23:10 APM-Analytics               psg-dynatrace-qa.abc.com      26    19          TEN_MIN 73&lt;/P&gt;

&lt;P&gt;I need to calculate the total of sum column and compare it with the total of today's&lt;/P&gt;

&lt;P&gt;I get the total for yesterdays using this command&lt;/P&gt;

&lt;P&gt;| &lt;STRONG&gt;dyntapplications&lt;/STRONG&gt; dynt_server=psg-dynatrace-qa.abc.com | search name=* | map search="|dyntmetricdata dynt_server=psg-dynatrace-qa.abc.com application=$name$ metric_path=\"Application Infrastructure Performance|*|Agent|Agent Channels|App Config Poll\" earliest=-1d@d latest=@d  " | addcoltotals sum | tail 1&lt;/P&gt;

&lt;P&gt;But I dont know how to compare with todays. Can someone please help&lt;/P&gt;

&lt;P&gt;I did try this&lt;BR /&gt;
&lt;A href="https://www.splunk.com/en_us/blog/tips-and-tricks/compare-two-time-ranges-in-one-report.html" target="_blank"&gt;https://www.splunk.com/en_us/blog/tips-and-tricks/compare-two-time-ranges-in-one-report.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;but it doesnt work for me since my data is from a custom command I guess&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 05:15:09 GMT</pubDate>
    <dc:creator>Harishma</dc:creator>
    <dc:date>2020-09-30T05:15:09Z</dc:date>
    <item>
      <title>Compare todays data with yesterdays for results from a custom command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488842#M136529</link>
      <description>&lt;P&gt;I have a custom command that returns results in tabular format with a _time column as well.&lt;/P&gt;

&lt;P&gt;Its something like below&lt;/P&gt;

&lt;P&gt;| &lt;STRONG&gt;dyntapplications&lt;/STRONG&gt; dynt_server=psg-dynatrace-qa.abc.com | search name=* | map search="| &lt;EM&gt;dyntmetricdata&lt;/EM&gt; dynt_server=psg-dynatrace-qa.abc.com application=$name$ metric_path=\"Application Infrastructure Performance|*|Agent|Agent Channels|App Config Poll\" earliest=-1d@d latest=@d  "&lt;/P&gt;

&lt;P&gt;time                    application                dynt_server                            count current frequency   sum&lt;BR /&gt;
4/28/2020 0:00  PBM-Analytics-UAT   psg-dynatrace-qa.abc.com          20    11          TEN_MIN 7&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
4/28/2020 23:00 PBM-Analytics-UAT   psg-dynatrace-qa.abc.com          20    11          TEN_MIN 78&lt;BR /&gt;
4/28/2020 0:10  APM-Analytics               psg-dynatrace-qa.abc.com      23    14          TEN_MIN 77&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
4/28/2020 23:10 APM-Analytics               psg-dynatrace-qa.abc.com      26    19          TEN_MIN 73&lt;/P&gt;

&lt;P&gt;I need to calculate the total of sum column and compare it with the total of today's&lt;/P&gt;

&lt;P&gt;I get the total for yesterdays using this command&lt;/P&gt;

&lt;P&gt;| &lt;STRONG&gt;dyntapplications&lt;/STRONG&gt; dynt_server=psg-dynatrace-qa.abc.com | search name=* | map search="|dyntmetricdata dynt_server=psg-dynatrace-qa.abc.com application=$name$ metric_path=\"Application Infrastructure Performance|*|Agent|Agent Channels|App Config Poll\" earliest=-1d@d latest=@d  " | addcoltotals sum | tail 1&lt;/P&gt;

&lt;P&gt;But I dont know how to compare with todays. Can someone please help&lt;/P&gt;

&lt;P&gt;I did try this&lt;BR /&gt;
&lt;A href="https://www.splunk.com/en_us/blog/tips-and-tricks/compare-two-time-ranges-in-one-report.html" target="_blank"&gt;https://www.splunk.com/en_us/blog/tips-and-tricks/compare-two-time-ranges-in-one-report.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;but it doesnt work for me since my data is from a custom command I guess&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:15:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488842#M136529</guid>
      <dc:creator>Harishma</dc:creator>
      <dc:date>2020-09-30T05:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Compare todays data with yesterdays for results from a custom command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488843#M136530</link>
      <description>&lt;P&gt;Hi @Harishma,&lt;/P&gt;

&lt;P&gt;What do you get from your search you exclude &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; ?  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dyntapplications dynt_server=psg-dynatrace-qa.abc.com | search name= | map search="|dyntmetricdata dynt_server=psg-dynatrace-qa.abc.com application=$name$ metric_path=\"Application Infrastructure Performance||Agent|Agent Channels|App Config Poll\" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Does this give you result based on your time picker or does it return all time based on your custom command ? &lt;/P&gt;

&lt;P&gt;You can run an &lt;CODE&gt;eval&lt;/CODE&gt; command to tag today's data as today and yesterday data as yesterday and then take it from there for the comparing both days. Something like this would do : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...
| eval startToday = relative_time(now(),"-24h@h")
 | eval startYesterday = relative_time(now(),"-48h@h")
 | eval marker = case(_time &amp;gt;= startToday, "Today",
                      _time &amp;gt;=startYesterday,"Yesterday",
                      1=1,"Outside Range")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if that helps.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 12:10:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488843#M136530</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2020-04-29T12:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Compare todays data with yesterdays for results from a custom command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488844#M136531</link>
      <description>&lt;P&gt;Does this give you result based on your time picker or does it return all time based on your custom command ?&lt;/P&gt;

&lt;P&gt;This gives result based on _time in custom command i.e it uses earliest and latest and doesnt use time picker&lt;/P&gt;

&lt;P&gt;I tried something like below and it didnt help me &lt;/P&gt;

&lt;P&gt;[| dyntapplications dynt_server=psg-dynatrace-qa.abc.com | search name=* | map search="|dyntmetricdata  dynt_server=psg-dynatrace-qa.abc.com application=$name$ metric_path=\"Application Infrastructure Performance|&lt;EM&gt;|Agent|Agent Channels|App Config Poll\" earliest=-1d@d latest=@d  " |fields sum _time| addcoltotals sum | tail 1 ] | eval ReportKey="today"  | append [ search [| dyntapplications dynt_server=psg-dynatrace-qa.abc.com | search name=&lt;/EM&gt; | map search="|dyntmetricdata  dynt_server=psg-dynatrace-qa.abc.com application=$name$ metric_path=\"Application Infrastructure Performance|*|Agent|Agent Channels|App Config Poll\" earliest=-0d@d latest=now " |fields sum _time| addcoltotals sum | tail 1] | eval ReportKey="today" ] | chart count by ReportKey&lt;/P&gt;

&lt;P&gt;The eval command you gave me is adding two additional columns called startToday and startYesterday.&lt;BR /&gt;
How can I use it to compare the two Sums?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:15:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488844#M136531</guid>
      <dc:creator>Harishma</dc:creator>
      <dc:date>2020-09-30T05:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Compare todays data with yesterdays for results from a custom command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488845#M136532</link>
      <description>&lt;P&gt;Hi @Harishma,&lt;/P&gt;

&lt;P&gt;Actually the important field that's added in the search I sent you is &lt;CODE&gt;marker&lt;/CODE&gt; it will allow you to see which data is from today and which data is from yesterday.&lt;/P&gt;

&lt;P&gt;So running something like this would allow you to compare both days on a timechart : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     ...
     | eval startToday = relative_time(now(),"-24h@h")
      | eval startYesterday = relative_time(now(),"-48h@h")
      | eval marker = case(_time &amp;gt;= startToday, "Today",
                           _time &amp;gt;=startYesterday,"Yesterday",
                           1=1,"Outside Range")
    | timechart count by marker
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the overall search should be like this : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dyntapplications dynt_server=psg-dynatrace-qa.abc.com 
| search name= | map search="|dyntmetricdata dynt_server=psg-dynatrace-qa.abc.com application=$name$ metric_path=\"Application Infrastructure Performance||Agent|Agent Channels|App Config Poll\" earliest=-1d@d latest=now " 
|fields sum _time 
| rename sum as total
| eval startToday = relative_time(now(),"-24h@h")
| eval startYesterday = relative_time(now(),"-48h@h")
| eval marker = case(_time &amp;gt;= startToday, "Today",
                           _time &amp;gt;=startYesterday,"Yesterday",
                           1=1,"Outside Range")
| timechart sum(total) as total by marker
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Apr 2020 08:31:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488845#M136532</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2020-04-30T08:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Compare todays data with yesterdays for results from a custom command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488846#M136533</link>
      <description>&lt;P&gt;@DavidHourani &lt;/P&gt;

&lt;P&gt;Thankyou ver much that helps, I can now see the variation over time in a graph.&lt;/P&gt;

&lt;P&gt;Another help if possible,&lt;BR /&gt;
Can you please let me know if its possible to calculate the difference % Increase/Decrease over the 24 hours?&lt;BR /&gt;
For example yesterday's sum was 100 and today's its 90 and that's a drop by 10% ...&lt;BR /&gt;
If not %, Can we calculate increase or decrease value over 24 hours ? Could you please help me..&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2020 09:49:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488846#M136533</guid>
      <dc:creator>Harishma</dc:creator>
      <dc:date>2020-05-03T09:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Compare todays data with yesterdays for results from a custom command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488847#M136534</link>
      <description>&lt;P&gt;Yes its possible to get the % increase and decrease, you can do that using &lt;CODE&gt;autoregress&lt;/CODE&gt; command which will allow you to see both the data from now with the previous value on the same line, from there you can run an&lt;CODE&gt;eval&lt;/CODE&gt; command to get the % change. &lt;/P&gt;

&lt;P&gt;Reference for autoregress can be found here :&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Autoregress"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Autoregress&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2020 10:01:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-todays-data-with-yesterdays-for-results-from-a-custom/m-p/488847#M136534</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2020-05-03T10:01:05Z</dc:date>
    </item>
  </channel>
</rss>

