<?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 get a case insensitive host answer from the metadata command? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-a-case-insensitive-host-answer-from-the-metadata/m-p/335315#M62014</link>
    <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts index=*  | search host=*syslog* |  table host recentTime lastTime | eval host=lower(host) | stats max(recentTime) as recentTime max(lastTime) as lastTime by host | sort -recentTime | convert ctime(recentTime) ctime(lastTime) timeformat="%x %X"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 25 Jan 2018 21:28:02 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2018-01-25T21:28:02Z</dc:date>
    <item>
      <title>How do I get a case insensitive host answer from the metadata command?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-a-case-insensitive-host-answer-from-the-metadata/m-p/335314#M62013</link>
      <description>&lt;P&gt;When I use metadata &lt;CODE&gt;type=hosts&lt;/CODE&gt; I get data for host names that are all uppercase and data for host names that are all lowercase.  I have not found a way combine the data.&lt;BR /&gt;&lt;BR /&gt;
My objective is to get the real and most recent value for  &lt;CODE&gt;lastTime&lt;/CODE&gt; for a host - not a value for the uppercase host name and another value for the lowercase version of the host name.  Here are examples.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts index=*  | search host=*syslog* |  table host recentTime lastTime | sort -recentTime | eval recentTime = strftime(recentTime, "%x %X") | eval lastTime = strftime(lastTime, "%x %X")
host    recentTime  lastTime
NLGPHQVSYSLOG2  01/25/18 16:02:49   01/25/18 16:02:47
NLGPPTVSYSLOG1  01/25/18 16:02:27   01/25/18 16:02:26
nlgphqvsyslog2  01/25/18 15:45:31   01/24/18 04:00:18
nlgpptvsyslog1  01/25/18 12:33:00   01/23/18 03:59:56
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I add &lt;CODE&gt;| eval host=lower(host)&lt;/CODE&gt; I get this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host    recentTime  lastTime
nlgpptvsyslog1  01/25/18 16:08:47   01/25/18 16:08:45
nlgphqvsyslog2  01/25/18 16:08:22   01/25/18 16:08:17
nlgphqvsyslog2  01/25/18 15:45:31   01/24/18 04:00:18
nlgpptvsyslog1  01/25/18 12:33:00   01/23/18 03:59:56
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I thought I would try to use &lt;CODE&gt;latest(lastTime)&lt;/CODE&gt; by host.  The values become blank.  It looks like the latest function cannot work on the metadata events.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts index=*  | search host=*syslog* | eval host=lower(host) | stats latest(recentTime), latest(lastTime) by host | table host recentTime lastTime | sort -recentTime | eval recentTime = strftime(recentTime, "%x %X") | eval lastTime = strftime(lastTime, "%x %X")

host    recentTime  lastTime
nlgphqvsyslog2       
nlgpptvsyslog1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jan 2018 21:15:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-a-case-insensitive-host-answer-from-the-metadata/m-p/335314#M62013</guid>
      <dc:creator>HMTODD</dc:creator>
      <dc:date>2018-01-25T21:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a case insensitive host answer from the metadata command?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-a-case-insensitive-host-answer-from-the-metadata/m-p/335315#M62014</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts index=*  | search host=*syslog* |  table host recentTime lastTime | eval host=lower(host) | stats max(recentTime) as recentTime max(lastTime) as lastTime by host | sort -recentTime | convert ctime(recentTime) ctime(lastTime) timeformat="%x %X"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jan 2018 21:28:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-a-case-insensitive-host-answer-from-the-metadata/m-p/335315#M62014</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-01-25T21:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a case insensitive host answer from the metadata command?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-a-case-insensitive-host-answer-from-the-metadata/m-p/335316#M62015</link>
      <description>&lt;P&gt;Instead of doing &lt;CODE&gt;latest(lastTime)&lt;/CODE&gt;, you should be able to do &lt;CODE&gt;max(lastTime)&lt;/CODE&gt; before you use &lt;CODE&gt;strftime&lt;/CODE&gt; on the field. When working with an epoch timestamp, &lt;CODE&gt;max()&lt;/CODE&gt; should be functionally equivalent to &lt;CODE&gt;latest()&lt;/CODE&gt;. Conversely, the equivalent of &lt;CODE&gt;earliest()&lt;/CODE&gt; would be &lt;CODE&gt;min()&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 21:29:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-a-case-insensitive-host-answer-from-the-metadata/m-p/335316#M62015</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-01-25T21:29:22Z</dc:date>
    </item>
  </channel>
</rss>

