<?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: Convert Dynamic Date into Variable. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Convert-Dynamic-Date-into-Variable/m-p/254939#M76352</link>
    <description>&lt;P&gt;here is my search query.. &lt;BR /&gt;
 * index=index1 sourcetype=sourcetype1 field1=Comp_prop host=host1 earliest=-1d@d latest=now | sort field1| table Ram_Size, Disk_Space| untable _time Metrics Value | eval Date=strftime(_time,"%m-%d-%y") | chart first(Value) over Metrics by Date limit=0 | eval values_changed= if(previous_day==current_day,"NO","YES") *&lt;/P&gt;

&lt;P&gt;Here field1 contains System_Properties like Ram_size, Disk_Space etc. The Disk_Space must not change, if in case it changes I must get the value "YES" in values_changed field.   My output must be like &lt;/P&gt;

&lt;P&gt;Metrics       10-11-15   10-12-15   values_changed&lt;BR /&gt;&lt;BR /&gt;
Disk_Space    25000     20000                YES&lt;BR /&gt;
Ram_Size          4                  4                  NO&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 07:36:35 GMT</pubDate>
    <dc:creator>SridharS</dc:creator>
    <dc:date>2020-09-29T07:36:35Z</dc:date>
    <item>
      <title>Convert Dynamic Date into Variable.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Dynamic-Date-into-Variable/m-p/254936#M76349</link>
      <description>&lt;P&gt;Here is my search query&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;... earliest=-2d@d latest=now....| untable _time Metrics Value | eval Date=strftime(_time,"%m-%d-%y") | chart first(Value) over Metrics by Date limit=0...&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Here I get the output field names in date format i.e. 09-30-15 10-01-15 . I want to convert this field name into variable so that I can pass the variable to use it for a comparison. &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;...| streamstats window=2 current=t global=f&lt;BR /&gt;
          values(09-30-15) as previous_day&lt;BR /&gt;
          values(10-01-15) as current_day&lt;BR /&gt;
       by Metrics&lt;BR /&gt;
     | eval values_changed= if(previous_day==current_day,"NO","YES")&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;I tried many ways but no luck.   &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:27:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Dynamic-Date-into-Variable/m-p/254936#M76349</guid>
      <dc:creator>SridharS</dc:creator>
      <dc:date>2020-09-29T07:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Dynamic Date into Variable.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Dynamic-Date-into-Variable/m-p/254937#M76350</link>
      <description>&lt;P&gt;Unless you provide a full search or sample data, I do not thing anybody is going to be able to understand your situation.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 15:01:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Dynamic-Date-into-Variable/m-p/254937#M76350</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-06T15:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Dynamic Date into Variable.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Dynamic-Date-into-Variable/m-p/254938#M76351</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... earliest=-2d@d latest=now....| untable _time Metrics Value | eval Date=if(_time&amp;lt;relative_time(now(),"-1d@d"), "current_day","previous_day") | chart first(Value) over Metrics by Date limit=0 | eval values_changed= if(previous_day==current_day,"NO","YES")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt;&lt;BR /&gt;
Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 sourcetype=sourcetype1 field1=Comp_prop host=host1 earliest=-1d@d latest=now | sort field1| table _time Ram_Size, Disk_Space| untable _time Metrics Value | eval Date=if(_time&amp;lt;relative_time(now(),"@d"), "previous_day","current_day") | chart first(Value) over Metrics by Date limit=0 | eval values_changed= if(previous_day==current_day,"NO","YES")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Oct 2015 15:17:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Dynamic-Date-into-Variable/m-p/254938#M76351</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-10-06T15:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Dynamic Date into Variable.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Dynamic-Date-into-Variable/m-p/254939#M76352</link>
      <description>&lt;P&gt;here is my search query.. &lt;BR /&gt;
 * index=index1 sourcetype=sourcetype1 field1=Comp_prop host=host1 earliest=-1d@d latest=now | sort field1| table Ram_Size, Disk_Space| untable _time Metrics Value | eval Date=strftime(_time,"%m-%d-%y") | chart first(Value) over Metrics by Date limit=0 | eval values_changed= if(previous_day==current_day,"NO","YES") *&lt;/P&gt;

&lt;P&gt;Here field1 contains System_Properties like Ram_size, Disk_Space etc. The Disk_Space must not change, if in case it changes I must get the value "YES" in values_changed field.   My output must be like &lt;/P&gt;

&lt;P&gt;Metrics       10-11-15   10-12-15   values_changed&lt;BR /&gt;&lt;BR /&gt;
Disk_Space    25000     20000                YES&lt;BR /&gt;
Ram_Size          4                  4                  NO&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:36:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Dynamic-Date-into-Variable/m-p/254939#M76352</guid>
      <dc:creator>SridharS</dc:creator>
      <dc:date>2020-09-29T07:36:35Z</dc:date>
    </item>
  </channel>
</rss>

