<?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 How to do time-based lookup using python? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-do-time-based-lookup-using-python/m-p/99383#M1405</link>
    <description>&lt;P&gt;Anyone out there doing time-based lookups with an external python script?  How do you handle the time portion of the lookup configuration?  Same as you would for a CSV lookup?  &lt;/P&gt;</description>
    <pubDate>Sat, 04 Dec 2010 10:04:32 GMT</pubDate>
    <dc:creator>Jeremiah</dc:creator>
    <dc:date>2010-12-04T10:04:32Z</dc:date>
    <item>
      <title>How to do time-based lookup using python?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-do-time-based-lookup-using-python/m-p/99383#M1405</link>
      <description>&lt;P&gt;Anyone out there doing time-based lookups with an external python script?  How do you handle the time portion of the lookup configuration?  Same as you would for a CSV lookup?  &lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2010 10:04:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-do-time-based-lookup-using-python/m-p/99383#M1405</guid>
      <dc:creator>Jeremiah</dc:creator>
      <dc:date>2010-12-04T10:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to do time-based lookup using python?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-do-time-based-lookup-using-python/m-p/99384#M1406</link>
      <description>&lt;P&gt;Per Steve Zhang, the Director of Search, there are two ways to do a time-based external lookup.  &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;Have Splunk’s lookup mechanism handle the temporal aspect&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;In this case, the external lookup returns all relevant matches over all-time, and Splunk will constrain matches based on the time_field, time_format, etc specified in transforms.conf.  This is analogous to how time-based CSV-based lookups work in Splunk.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;The time-based configuration would perform the comparison on the time values and return the relevant results to search based on the lookup configuration.&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Let the external script handle the temporal aspect implicitly by adding _time as a field to match on&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;In this case, the external script will need to know that the value of _time is not an exact match against the “time” column above, but rather “closest but no later than”&lt;/LI&gt;
&lt;/UL&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Which approach to implement depends on how often the matching field changes – in other words, over all time, how many different rows are there that contain a given value to be matched upon?&lt;/P&gt;

&lt;P&gt;If the number of rows/changes is small, then either option above should be fine.  It the number is large, then letting the script handle time matching is likely better.&lt;/P&gt;

&lt;P&gt;In either case, it would be wise to implement caching to reduce calls to the DB.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2010 05:04:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-do-time-based-lookup-using-python/m-p/99384#M1406</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2010-12-08T05:04:51Z</dc:date>
    </item>
  </channel>
</rss>

