<?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 to generate a search that will match an extracted field with a column name in my CSV lookup? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248626#M74238</link>
    <description>&lt;P&gt;Did you try formatting your lookup as I mentioned and tried??&lt;BR /&gt;
Also, your lookup seems have duplicate values of RTR_Call so you might want to include more fields in lookup command to get appropriate results.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jan 2017 19:06:19 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-01-23T19:06:19Z</dc:date>
    <item>
      <title>How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248617#M74229</link>
      <description>&lt;P&gt;![alt text][1]Hello Splunkers,&lt;/P&gt;

&lt;P&gt;I have a search which has some extracted fields and I am trying to match one of the extracted field with a column name in CSV and extracting other data &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=router_logs 
|rex "\[[^\"]+\]\s.\"(?(?\S+)\s(?\S+))[^\"]+\"\s(?\d+)\s(?RTR_HTTP_Other&amp;gt;\d+).+x_forwarded_for:.\"(?[\d\.]+).+vcap_request_id:(?\S+)\sresponse_time:(?\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Lookup:&lt;/P&gt;

&lt;P&gt;abc.csv (attached)&lt;/P&gt;

&lt;P&gt;I am trying to do a search which will give me the output with RTR_Call and the value of the response code(Good,Bad) along with response code(200,401,402 etc).&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 21:34:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248617#M74229</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2017-01-20T21:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248618#M74230</link>
      <description>&lt;P&gt;First, make your csv a lookup by going to &lt;CODE&gt;Settings&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;Lookups&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;Lookup Definitions&lt;/CODE&gt; -&amp;gt; &lt;CODE&gt;New&lt;/CODE&gt; and saving as, for example, &lt;CODE&gt;MyNewLookup&lt;/CODE&gt;.&lt;BR /&gt;
Then search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=router_logs |rex "\[[^\"]+\]\s.\"(?&amp;lt;RTR_Call&amp;gt;(?&amp;lt;RTR_Method&amp;gt;\S+)\s(?&amp;lt;RTR_HTTP_Path&amp;gt;\S+))[^\"]+\"\s(?&amp;lt;RTR_HTTP_Resp&amp;gt;\d+)\s(?&amp;lt;RTR_HTTP_Other&amp;gt;\d+).+x_forwarded_for:.\"(?&amp;lt;RTR_X_Forwarded_For&amp;gt;[\d\.]+).+vcap_request_id:(?&amp;lt;vcap_request&amp;gt;\S+)\sresponse_time:(?&amp;lt;RTR_Resp_Time&amp;gt;\S+)" | lookup MyNewLookup RTR_Call
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jan 2017 21:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248618#M74230</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-01-20T21:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248619#M74231</link>
      <description>&lt;P&gt;How many rows are there in the lookup? Do you have option to change the format of lookup?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 21:52:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248619#M74231</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-20T21:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248620#M74232</link>
      <description>&lt;P&gt;if we get the result then there would be no problem changing it,there are 592 rows,Do you have any suggestions to change the lookup&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 23:42:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248620#M74232</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2017-01-20T23:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248621#M74233</link>
      <description>&lt;P&gt;I have added already added it as a lookup,but I am trying to match with a common field and get the reposne codes of it&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 23:43:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248621#M74233</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2017-01-20T23:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248622#M74234</link>
      <description>&lt;P&gt;This lookup should pull in all fields, is it? Is the problem is that you are not interested in fields called &lt;CODE&gt;400&lt;/CODE&gt;, etc. but in a single field called error that has a value of &lt;CODE&gt;400&lt;/CODE&gt;?  If so, you need to write a search (which we can help you do) to convert the format of your csv so that the lookup will pull in correctly.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2017 01:22:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248622#M74234</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-01-21T01:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248623#M74235</link>
      <description>&lt;P&gt;Initially we were calculating  the Good and bad by doing an eval command.&lt;/P&gt;

&lt;P&gt;| eval isgood=if(RTR_HTTP_Resp&amp;lt;300,1,0) .But now we want to populate good or bad of the response codes from the lookup for each RTR_Call.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:30:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248623#M74235</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2020-09-29T12:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248624#M74236</link>
      <description>&lt;P&gt;I don't see the attached file now but based on what I remember of your lookup table, instead of below format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;RTR_Call, someother field,200,302,40...all other http response codes as column
xyz, abc,good,good,bad...all other http response values
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;, you need to convert it to a simpler lookup format as&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;RTR_Call, someother field,response_code value
xyz,abc,200,good
xyz,abc,200,good
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So that you can do a simple lookup as (check the field names)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=router_logs | rex 
"\[[^\"]+\]\s.\"(?&amp;lt;RTR_Call&amp;gt;(?&amp;lt;RTR_Method&amp;gt;\S+)\s(?&amp;lt;RTR_HTTP_Path&amp;gt;\S+))[^\"]+\"\s(?&amp;lt;RTR_HTTP_Resp&amp;gt;\d+)\s(?&amp;lt;RTR_HTTP_Other&amp;gt;\d+).+x_forwarded_for:.\"(?&amp;lt;RTR_X_Forwarded_For&amp;gt;[\d\.]+).+vcap_request_id:(?&amp;lt;vcap_request&amp;gt;\S+)\sresponse_time:(?&amp;lt;RTR_Resp_Time&amp;gt;\S+)" | lookup MyNewLookup RTR_Call as RTR_Method response_code as RTR_HTTP_Resp OUTPUT value
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Jan 2017 20:10:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248624#M74236</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-22T20:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248625#M74237</link>
      <description>&lt;P&gt;sorry I have attached the lookup now.&lt;/P&gt;

&lt;P&gt;Initially we were calculating the Good and bad by doing an eval command.&lt;/P&gt;

&lt;P&gt;| eval isgood=if(RTR_HTTP_Resp&amp;lt;300,1,0) .But now we want to populate good or bad of the response codes from the lookup for each RTR_Call from search&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:34:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248625#M74237</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2020-09-29T12:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248626#M74238</link>
      <description>&lt;P&gt;Did you try formatting your lookup as I mentioned and tried??&lt;BR /&gt;
Also, your lookup seems have duplicate values of RTR_Call so you might want to include more fields in lookup command to get appropriate results.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 19:06:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248626#M74238</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-23T19:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248627#M74239</link>
      <description>&lt;P&gt;Sorry for the confusion Somesh, the lookup format cannot be changed as it affects other searches ,so is there a way to do a lookup in csv and save the result to a variable&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 16:12:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248627#M74239</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2017-01-24T16:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search that will match an extracted field with a column name in my CSV lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248628#M74240</link>
      <description>&lt;P&gt;Well, you can try this in-efficient option using join command. In the join subsearch, there is a command for fields, when you need to remove all other fields which are not required, basically everything except RTR_Call and response code columns.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=router_logs | rex 
 "\[[^\"]+\]\s.\"(?&amp;lt;RTR_Call&amp;gt;(?&amp;lt;RTR_Method&amp;gt;\S+)\s(?&amp;lt;RTR_HTTP_Path&amp;gt;\S+))[^\"]+\"\s(?&amp;lt;RTR_HTTP_Resp&amp;gt;\d+)\s(?&amp;lt;RTR_HTTP_Other&amp;gt;\d+).+x_forwarded_for:.\"(?&amp;lt;RTR_X_Forwarded_For&amp;gt;[\d\.]+).+vcap_request_id:(?&amp;lt;vcap_request&amp;gt;\S+)\sresponse_time:(?&amp;lt;RTR_Resp_Time&amp;gt;\S+)" | join type=left RTR_Method RTR_HTTP_Resp [| inputlookup yourlookup.csv | fields - field1 field2 | untable RTR_Call RTR_HTTP_Resp value ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After removing the not required fields and running the untable command, your lookup data will be transformed into the new format that I was suggesting and you would be able to join.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 16:25:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-that-will-match-an-extracted-field-with/m-p/248628#M74240</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-24T16:25:04Z</dc:date>
    </item>
  </channel>
</rss>

