<?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 can I extract a field using &amp;quot;lookup&amp;quot; and a .csv file that doesn't pair to an event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-field-using-quot-lookup-quot-and-a-csv-file/m-p/175335#M50325</link>
    <description>&lt;P&gt;The answer from @lguinn is incorrect; your lookup should work fine but there were a few tweaks that should make your stuff work (better), &lt;EM&gt;PROVIDED&lt;/EM&gt; your lookup table has a field called &lt;EM&gt;exactly&lt;/EM&gt; &lt;CODE&gt;crit_threshold&lt;/CODE&gt; (it might actually be, for example, &lt;CODE&gt;crit_threshhold&lt;/CODE&gt;); try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=perfmon source="perfmon:logicaldisk" instance!=_Total instance!=HarddiskVolume1 counter="% Free Space" | eval pct_used=round(100-Value,2) | stats last(pct_used) AS pct_used BY host instance | lookup disk_thresholds host mount AS instance | eval crit_threshold=coalesce(crit_threshold,70) | where pct_used &amp;gt; crit_threshold
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 18 Jul 2015 05:26:12 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-07-18T05:26:12Z</dc:date>
    <item>
      <title>How can I extract a field using "lookup" and a .csv file that doesn't pair to an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-field-using-quot-lookup-quot-and-a-csv-file/m-p/175333#M50323</link>
      <description>&lt;P&gt;I'm trying to match event data with preset limits recorded in a .csv file.&lt;/P&gt;

&lt;P&gt;My search looks for a host and its percentage usage of disk space. I want to pair it with an arbitrarily set maximum % used that varies by server.&lt;BR /&gt;
e.g. Host BUMBLEBEE can have 95% disk usage, but ITCHY can only have 90%.&lt;/P&gt;

&lt;P&gt;How do I get lookup to pair the maximum usage value from the .csv file to the event data that shows the % disk space used?&lt;/P&gt;

&lt;P&gt;This is my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=perfmon source="perfmon:logicaldisk" instance!=_Total instance!=HarddiskVolume1 counter="% Free Space"
|eval "pct_used"=round(100-Value,2)|eval mount=instance
 |eval uniq=host."_".mount|dedup uniq
| stats last("pct_used") AS pct_used by host,mount |lookup disk_thresholds host,mount 
| eval crit_threshold=coalesce(crit_threshold,70) 

| where pct_used &amp;gt; crit_threshold`
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jun 2015 18:30:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-field-using-quot-lookup-quot-and-a-csv-file/m-p/175333#M50323</guid>
      <dc:creator>mdennisAPFCU</dc:creator>
      <dc:date>2015-06-24T18:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a field using "lookup" and a .csv file that doesn't pair to an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-field-using-quot-lookup-quot-and-a-csv-file/m-p/175334#M50324</link>
      <description>&lt;P&gt;The logic of your search is fine. A lookup does not have to match an "event" per se, it matches against a field. &lt;/P&gt;

&lt;P&gt;The syntax of your lookup command is wrong. It should be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup disk_thresholds host mount OUTPUT crit_threshold
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Assuming that you have uploaded a CSV file and setup a lookup named disk_thresholds with the appropriate fields.&lt;/P&gt;

&lt;P&gt;Here is a &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/Knowledge/Usefieldlookupstoaddinformationtoyourevents"&gt;step by step guide to setting up a lookup&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2015 20:14:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-field-using-quot-lookup-quot-and-a-csv-file/m-p/175334#M50324</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-06-24T20:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a field using "lookup" and a .csv file that doesn't pair to an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-field-using-quot-lookup-quot-and-a-csv-file/m-p/175335#M50325</link>
      <description>&lt;P&gt;The answer from @lguinn is incorrect; your lookup should work fine but there were a few tweaks that should make your stuff work (better), &lt;EM&gt;PROVIDED&lt;/EM&gt; your lookup table has a field called &lt;EM&gt;exactly&lt;/EM&gt; &lt;CODE&gt;crit_threshold&lt;/CODE&gt; (it might actually be, for example, &lt;CODE&gt;crit_threshhold&lt;/CODE&gt;); try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=perfmon source="perfmon:logicaldisk" instance!=_Total instance!=HarddiskVolume1 counter="% Free Space" | eval pct_used=round(100-Value,2) | stats last(pct_used) AS pct_used BY host instance | lookup disk_thresholds host mount AS instance | eval crit_threshold=coalesce(crit_threshold,70) | where pct_used &amp;gt; crit_threshold
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Jul 2015 05:26:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-field-using-quot-lookup-quot-and-a-csv-file/m-p/175335#M50325</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-18T05:26:12Z</dc:date>
    </item>
  </channel>
</rss>

