<?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: add fields to the query based on the lookup file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131311#M35797</link>
    <description>&lt;P&gt;this query too jus extracts the fields and not the values along with the fields..&lt;BR /&gt;
is it possible to extract the values too from the JSON along with the fields and display it in a table.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Nov 2013 14:54:16 GMT</pubDate>
    <dc:creator>spyme72</dc:creator>
    <dc:date>2013-11-11T14:54:16Z</dc:date>
    <item>
      <title>add fields to the query based on the lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131307#M35793</link>
      <description>&lt;P&gt;i have got json data like below. i have a lookup file defined with technology and fields which i would want to display.&lt;BR /&gt;
it would help even if i can replace the fields from the lookup table in the query&lt;BR /&gt;
basically i want to add fields to the query based on the lookup file&lt;BR /&gt;
Query :&lt;BR /&gt;
index= tech sourcetype=json technology=os [|inputlookup techtable| technology= OS |fields fields]&lt;/P&gt;

&lt;P&gt;lookup table:&lt;BR /&gt;
technology   fields&lt;BR /&gt;
OS       host&lt;BR /&gt;
OS       hostname&lt;BR /&gt;
SAP      gw/cpic_timeout&lt;BR /&gt;
SAP      gw/max_conn&lt;/P&gt;

&lt;P&gt;Json data:&lt;/P&gt;

&lt;P&gt;{&lt;BR /&gt;
  _technology : "OS",&lt;BR /&gt;
  architecture : "x86_64",&lt;BR /&gt;
  domain : "monsanto.com",&lt;BR /&gt;
  facterversion : "1.5.2",&lt;BR /&gt;
  fqdn : "std08a00.monsanto.com",&lt;BR /&gt;
  hardwaremodel : "x86_64",&lt;BR /&gt;
  hostname : "std08a00",&lt;BR /&gt;
  interfaces : "eth1",&lt;BR /&gt;
  ipaddress : "10.30.16.104",&lt;BR /&gt;
  ipaddress_eth1 : "10.30.16.104",&lt;BR /&gt;
  kernel : "Linux",&lt;BR /&gt;
  kernelrelease : "2.6.32.59-0.7-default",&lt;BR /&gt;
  kernelversion : "2.6.32.59",&lt;BR /&gt;
  lsbdistcodename : "n/a",&lt;BR /&gt;
  lsbdistdescription : "SUSE Linux Enterprise Server 11 (x86_64)",&lt;BR /&gt;
  lsbdistid : "SUSE LINUX",&lt;BR /&gt;
  lsbdistrelease : "11",&lt;BR /&gt;
  lsbrelease : "core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch",&lt;BR /&gt;
  macaddress_eth1 : "00:0C:29:BC:FD:88",&lt;BR /&gt;
  memoryfree : "26.34 GB",&lt;BR /&gt;
  memorysize : "31.49 GB",&lt;BR /&gt;
  netmask : "255.255.252.0",&lt;BR /&gt;
  netmask_eth1 : "255.255.252.0",&lt;BR /&gt;
  operatingsystem : "SLES",&lt;BR /&gt;
  operatingsystemrelease : "11.1",&lt;BR /&gt;
  processor0 : "Intel(R) Xeon(R) CPU E7- 2830  @ 2.13GHz",&lt;BR /&gt;
  processor1 : "Intel(R) Xeon(R) CPU E7- 2830  @ 2.13GHz",&lt;BR /&gt;
  processor2 : "Intel(R) Xeon(R) CPU E7- 2830  @ 2.13GHz",&lt;BR /&gt;
  processor3 : "Intel(R) Xeon(R) CPU E7- 2830  @ 2.13GHz",&lt;BR /&gt;
  processor4 : "Intel(R) Xeon(R) CPU E7- 2830  @ 2.13GHz",&lt;BR /&gt;
  processor5 : "Intel(R) Xeon(R) CPU E7- 2830  @ 2.13GHz",&lt;BR /&gt;
  processorcount : "6",&lt;BR /&gt;
  ps : "ps -ef",&lt;BR /&gt;
  puppetversion : "2.6.17",&lt;BR /&gt;
  rubysitedir : "/usr/lib64/ruby/site_ruby/1.8",&lt;BR /&gt;
  rubyversion : "1.8.7",&lt;BR /&gt;
  sshdsakey : "AAAAB3NzaC1kc3MAAACBAN3D818gre6+WfSiH6YJlxExf/Tmq/f2KLY8oN5bV40on31qt/8VA4ShsARgKSLX2HpoOINU3vv5ENqhpUs3W9pZotOTLaxTUmF4eYgaMsLVCJFYNGfOtDVvKVjxT9vybBkaJ/Ppq4VXajimMt9pGQ0oetx3C3V0drffzM5/gSdRAAAAFQDVVrQM10pD8YX++fuxvxYxZe1UpQAAAIEAuAmCYe1NXqLN9fk7zaXf9eCjW6oGFkNbpnk3rSXX7tlOjuibYQt1xL8jpVc0la/W5Cbt3dwyLB57ZauBoW/6agJTqIoU1X8PYy1qW1q2QsgNLGco9ZDBhKHX3Mo8i/gR7sW6sN3zaAoFWd3T4LF8vebFGyWRoQgmRQlIiFmfMmIAAACBAM4ClRwgdvuZN8JmiYgaf/RcWRcpBJLmhgCS2gZjb2Wu41Msb9ain4lJmEQu5T+hA/9lKo0EG6Sp+vzKIReNOFikEIQwl0Ttj/s9P1wZkba9NplQyZqqR0v/F2Md70SUg+7RiQJ/xTX0IVssW+YMsR3uGuC8Wy+V4V6rp7WeuJRv",&lt;BR /&gt;
  sshrsakey : "AAAAB3NzaC1yc2EAAAABIwAAAIEAtxsvJhJifxCqSKGjYQtXqc29iql+CAS9OK8r+zEM0q+MXEOFikoa2CvbXahwDdXmcWYbq6N11tCNu3q8NYdTpzSA94FPptPfT5akCSzvKcKzPXQ/xmnbnbd28Vh6eRVbeknikjQMvgYhwObDr1AzGvkv1YMd+rBPZTD5Ixj5vwk=",&lt;BR /&gt;
  swapfree : "31.99 GB",&lt;BR /&gt;
  swapsize : "31.99 GB",&lt;BR /&gt;
  virtual : "vmware"&lt;BR /&gt;
}&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:13:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131307#M35793</guid>
      <dc:creator>spyme72</dc:creator>
      <dc:date>2020-09-28T15:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: add fields to the query based on the lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131308#M35794</link>
      <description>&lt;P&gt;When you say "Add fields to the query", do you mean&lt;/P&gt;

&lt;P&gt;1 - to add the matching data from the lookup table to the results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= tech sourcetype=json technology=os [|inputlookup techtable| where technology= OS | fields fields]
| lookup techTable technology OUTPUT fields
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Although I think you could simplify to this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= tech sourcetype=json technology=os
| lookup techTable technology OUTPUT fields
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or 2 - to add the matching data from the lookup table to the search criteria&lt;/P&gt;

&lt;P&gt;I think you are almost doing this already&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= tech sourcetype=json technology=os [|inputlookup techtable| where technology= OS | fields fields]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Important Note: field matches are case-sensitive by default. I think that will be okay in your case.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 19:17:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131308#M35794</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-11-06T19:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: add fields to the query based on the lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131309#M35795</link>
      <description>&lt;P&gt;i want to add lookup table to the search criteria.&lt;/P&gt;

&lt;P&gt;for ex:&lt;BR /&gt;
index = tech sourcetype=json technology=os | fields ************&lt;BR /&gt;
i want the fields to be extracted from the lookuptable.i am trying to implement properties file kind of functionality , where when i add fields to the lookup table the search query in the app automaticaly detects it and uses it in its query.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 20:29:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131309#M35795</guid>
      <dc:creator>spyme72</dc:creator>
      <dc:date>2013-11-06T20:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: add fields to the query based on the lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131310#M35796</link>
      <description>&lt;P&gt;Answer #2 above should do that. Note that you need to add the &lt;CODE&gt;where&lt;/CODE&gt; command to the original search string, as illustrated in answer #2. Your original subsearch should return an error for invalid syntax.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 21:18:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131310#M35796</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-11-06T21:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: add fields to the query based on the lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131311#M35797</link>
      <description>&lt;P&gt;this query too jus extracts the fields and not the values along with the fields..&lt;BR /&gt;
is it possible to extract the values too from the JSON along with the fields and display it in a table.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2013 14:54:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131311#M35797</guid>
      <dc:creator>spyme72</dc:creator>
      <dc:date>2013-11-11T14:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: add fields to the query based on the lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131312#M35798</link>
      <description>&lt;P&gt;i think i have not posted my question clearly..&lt;/P&gt;

&lt;P&gt;inputlookup techtable| where technology= OS | fields fields would give the result of the fields i would want to use in my second query&lt;/P&gt;

&lt;P&gt;my second query is&lt;BR /&gt;
index=equivalency sourcetype=json | spath | stats list(*) as *| transpose&lt;BR /&gt;
which would result all the fields in the JSON.&lt;/P&gt;

&lt;P&gt;i want to pass the fields from the first query to the second query to filter the JSON data.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2013 19:10:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131312#M35798</guid>
      <dc:creator>spyme72</dc:creator>
      <dc:date>2013-11-11T19:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: add fields to the query based on the lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131313#M35799</link>
      <description>&lt;P&gt;i think i have not posted my question clearly..&lt;/P&gt;

&lt;P&gt;inputlookup techtable| where technology= OS | fields fields would give the result of the fields i would want to use in my second query&lt;/P&gt;

&lt;P&gt;my second query is&lt;BR /&gt;
index=equivalency sourcetype=json | spath | stats list(*) as *| transpose&lt;BR /&gt;
which would result all the fields in the JSON.&lt;/P&gt;

&lt;P&gt;i want to pass the fields from the first query to the second query to filter the JSON data.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2013 19:11:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-fields-to-the-query-based-on-the-lookup-file/m-p/131313#M35799</guid>
      <dc:creator>spyme72</dc:creator>
      <dc:date>2013-11-11T19:11:35Z</dc:date>
    </item>
  </channel>
</rss>

