<?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: Getting _time into a |rest search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Getting-time-into-a-rest-search/m-p/361144#M161208</link>
    <description>&lt;P&gt;You are adding &lt;CODE&gt;|eval _time=now()&lt;/CODE&gt; at the top and then performing a &lt;CODE&gt;| stats&lt;/CODE&gt; function which is not having the &lt;CODE&gt;_time&lt;/CODE&gt; field.&lt;BR /&gt;
Try adding &lt;CODE&gt;|eval _time=now()&lt;/CODE&gt; at the end.&lt;/P&gt;</description>
    <pubDate>Thu, 04 May 2017 09:32:39 GMT</pubDate>
    <dc:creator>dineshraj9</dc:creator>
    <dc:date>2017-05-04T09:32:39Z</dc:date>
    <item>
      <title>Getting _time into a |rest search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-time-into-a-rest-search/m-p/361143#M161207</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a client that does not have the App for Unix/Nix and does not want to install it.&lt;BR /&gt;
Problem: I need to get the _time into this somehow so it can be used as Metrics in a Base Search for ITSI and the search below isn't recognizing it&lt;BR /&gt;
I need to track Indexer Disk Usage and took this from another app to attempt to get it adding |eval _time=now()&lt;/P&gt;

&lt;P&gt;| rest splunk_server="&lt;EM&gt;Indexer01&lt;/EM&gt;" /services/server/status/partitions-space |eval _time=now()&lt;BR /&gt;
| eval free = if(isnotnull(available), available, free) &lt;BR /&gt;
| eval usage = round((capacity - free) / 1024, 2) &lt;BR /&gt;
| eval capacity = round(capacity / 1024, 2) &lt;BR /&gt;
| eval compare_usage = usage." / ".capacity &lt;BR /&gt;
| eval pct_usage = round(usage / capacity * 100, 2)&lt;BR /&gt;
| stats first(fs_type) as fs_type first(compare_usage) AS compare_usage first(pct_usage) as pct_usage by mount_point&lt;BR /&gt;
| eval OptMountUsage=(if(mount_point=="/opt/mount",pct_usage,NULL)), OptMountSplunkdata2Usage=(if(mount_point=="/opt/mount/splunkdata",pct_usage,NULL))&lt;/P&gt;

&lt;P&gt;Is there any way of doing this and if so, what would the resulting search look like for the Base Search?&lt;/P&gt;

&lt;P&gt;Many thanks as always&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:55:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-time-into-a-rest-search/m-p/361143#M161207</guid>
      <dc:creator>TheJagoff</dc:creator>
      <dc:date>2020-09-29T13:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting _time into a |rest search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-time-into-a-rest-search/m-p/361144#M161208</link>
      <description>&lt;P&gt;You are adding &lt;CODE&gt;|eval _time=now()&lt;/CODE&gt; at the top and then performing a &lt;CODE&gt;| stats&lt;/CODE&gt; function which is not having the &lt;CODE&gt;_time&lt;/CODE&gt; field.&lt;BR /&gt;
Try adding &lt;CODE&gt;|eval _time=now()&lt;/CODE&gt; at the end.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 09:32:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-time-into-a-rest-search/m-p/361144#M161208</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-05-04T09:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Getting _time into a |rest search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-time-into-a-rest-search/m-p/361145#M161209</link>
      <description>&lt;P&gt;hello TheJagoff,&lt;BR /&gt;
@dineshraj9 comment is great, here is how i slightly modified the search to give you the time field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest splunk_server="*" /services/server/status/partitions-space 
| eval _time=now()
| eval free = if(isnotnull(available), available, free) 
| eval usage = round((capacity - free) / 1024, 2) 
| eval capacity = round(capacity / 1024, 2) 
| eval compare_usage = usage." / ".capacity 
| eval pct_usage = round(usage / capacity * 100, 2)
| stats first(fs_type) as fs_type first(compare_usage) AS compare_usage first(pct_usage) as pct_usage by mount_point _time
| eval OptMountUsage=(if(mount_point=="/opt/mount",pct_usage,NULL)), OptMountSplunkdata2Usage=(if(mount_point=="/opt/mount/splunkdata",pct_usage,NULL))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Added _time after the &lt;STRONG&gt;by&lt;/STRONG&gt; clause in line 8 &lt;BR /&gt;
you can outputlookup or collect to summary and then run your base search against it.&lt;BR /&gt;
however, this is a multi step process while the OS module  for ITSI has this all pre-built in a much more efficient and clean way.&lt;BR /&gt;
any reason not installing the TA for nix?&lt;/P&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 12:54:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-time-into-a-rest-search/m-p/361145#M161209</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-05-04T12:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Getting _time into a |rest search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-time-into-a-rest-search/m-p/361146#M161210</link>
      <description>&lt;P&gt;After discussing this morning, they installed the App and Add-on for Unix/Nix this morning so it's all good either way.&lt;/P&gt;

&lt;P&gt;Your modifications to the |rest statement works perfectly. Many thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 13:41:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-time-into-a-rest-search/m-p/361146#M161210</guid>
      <dc:creator>TheJagoff</dc:creator>
      <dc:date>2017-05-04T13:41:43Z</dc:date>
    </item>
  </channel>
</rss>

