<?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: Stats and Look up in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667665#M229048</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can we combine stats and lookup on comparison of Tran and Look_Tran.&lt;/P&gt;&lt;P&gt;Current Results:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Tran&amp;nbsp; &amp;nbsp;Count&lt;/STRONG&gt; &lt;STRONG&gt;avgrt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Required Results (Matching&amp;nbsp;Transaction_Details&amp;nbsp; to be pulled based on Tran &amp;nbsp;from lookup)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Tran&lt;/STRONG&gt; &lt;STRONG&gt;Transaction_Details&amp;nbsp;&lt;/STRONG&gt; &lt;STRONG&gt;Count&lt;/STRONG&gt; &lt;STRONG&gt;avgrt&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Nov 2023 10:23:38 GMT</pubDate>
    <dc:creator>Satyapv</dc:creator>
    <dc:date>2023-11-07T10:23:38Z</dc:date>
    <item>
      <title>Stats and Look up</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667634#M229043</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;I have look up file with Transaction details and Transaction Name Like below. Will be great if someone suggest hot to handle below scenario.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Tran_lookup&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt; &lt;STRONG&gt;Transaction_Details&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp;Shopping&lt;/P&gt;&lt;P&gt;CDE&amp;nbsp; &amp;nbsp; Rent&lt;/P&gt;&lt;P&gt;From my splunk index i am running Stats command like below (Tran from index = Tran_lookup) from&amp;nbsp;&lt;/P&gt;&lt;P&gt;count(Tran) as count , Avg( responstime) as avgrt by&amp;nbsp;Tran&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to add matching Transaction_Details from lookup&amp;nbsp; to the final stats results:&lt;/P&gt;&lt;P&gt;Current Results:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Tran&amp;nbsp; &amp;nbsp;Count&lt;/STRONG&gt; &lt;STRONG&gt;avgrt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Required Results (Matching&amp;nbsp;Transaction_Details&amp;nbsp; to be pulled based on Tran )&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Tran&lt;/STRONG&gt; &lt;STRONG&gt;Transaction_Details&amp;nbsp;&lt;/STRONG&gt; &lt;STRONG&gt;Count&lt;/STRONG&gt; &lt;STRONG&gt;avgrt&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 04:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667634#M229043</guid>
      <dc:creator>Satyapv</dc:creator>
      <dc:date>2023-11-07T04:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Stats and Look up</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667655#M229046</link>
      <description>&lt;LI-CODE lang="markup"&gt;| lookup &amp;lt;lookup_name&amp;gt; Tran_lookup as Tran OUTPUT Transaction_Details&lt;/LI-CODE&gt;&lt;P&gt;Its recommended to create a lookup definition for your lookup files.&lt;BR /&gt;If you do so you replace the lookup name with the name of the lookup definition.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 09:39:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667655#M229046</guid>
      <dc:creator>FelixLeh</dc:creator>
      <dc:date>2023-11-07T09:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Stats and Look up</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667665#M229048</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can we combine stats and lookup on comparison of Tran and Look_Tran.&lt;/P&gt;&lt;P&gt;Current Results:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Tran&amp;nbsp; &amp;nbsp;Count&lt;/STRONG&gt; &lt;STRONG&gt;avgrt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Required Results (Matching&amp;nbsp;Transaction_Details&amp;nbsp; to be pulled based on Tran &amp;nbsp;from lookup)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Tran&lt;/STRONG&gt; &lt;STRONG&gt;Transaction_Details&amp;nbsp;&lt;/STRONG&gt; &lt;STRONG&gt;Count&lt;/STRONG&gt; &lt;STRONG&gt;avgrt&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 10:23:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667665#M229048</guid>
      <dc:creator>Satyapv</dc:creator>
      <dc:date>2023-11-07T10:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Stats and Look up</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667668#M229049</link>
      <description>&lt;P&gt;With the lookup command I mentioned in my first reply you can do so.&lt;BR /&gt;You have to replace "&amp;lt;lookup_name&amp;gt;" with the name of your lookup. If the field names you mentioned are correct then the query should work. Just add the line after the current result.&lt;BR /&gt;If it still doesnt work pls provide more information like the name of the lookup file, the exact names of the fields in the result and the exact names of the fields in the lookup file.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 10:38:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667668#M229049</guid>
      <dc:creator>FelixLeh</dc:creator>
      <dc:date>2023-11-07T10:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Stats and Look up</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667671#M229051</link>
      <description>&lt;P&gt;Look up file name is TransctionDetails.csv&lt;/P&gt;&lt;P&gt;if look at my initial post I have another query of stats to which I need to append&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;stats count(Tran) as count , Avg( responstime) as avgrt by&amp;nbsp;Tran where Tran_lookup matches with Tran in index.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Expected output is ( Corresponding Transaction Details should be added to stats output).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Count ,Tran, Transaction_Details, avgrt&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 10:53:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667671#M229051</guid>
      <dc:creator>Satyapv</dc:creator>
      <dc:date>2023-11-07T10:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Stats and Look up</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667672#M229052</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count(Tran) as count , Avg( responstime) as avgrt by Tran
| lookup TransctionDetails.csv Tran_lookup as Tran OUTPUT Transaction_Details
| fields Count ,Tran, Transaction_Details, avgrt &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you only want the Events that have matching Transaction_Details add:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where isnotnull(Transaction_Details)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Expectation in the Example is that the Lookup is inside of Splunk and correctly configured.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 11:46:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667672#M229052</guid>
      <dc:creator>FelixLeh</dc:creator>
      <dc:date>2023-11-07T11:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Stats and Look up</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667674#M229053</link>
      <description>&lt;P&gt;Thank you. It worked.&lt;/P&gt;&lt;P&gt;However i was reviewing index data Splunk index has data like below with versions of Tran. But lookup file only has ABC and CDE as&amp;nbsp;Transaction_Details is same for all versions of Tran. Such cases where there are multiple versions of Tran and 1 value of Transaction_Details is coming is empty. Is there a way lookup file can be searched for Prefix or some other way?&lt;/P&gt;&lt;P&gt;Tran&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ABC&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ABCVersion1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ABCVersion2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ABCVersion3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CDE&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CDE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CDEVersion1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CDEVersion2&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 11:51:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667674#M229053</guid>
      <dc:creator>Satyapv</dc:creator>
      <dc:date>2023-11-07T11:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Stats and Look up</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667675#M229054</link>
      <description>&lt;LI-CODE lang="markup"&gt;| stats count(Tran) as count , Avg( responstime) as avgrt by Tran
| rex field=Tran "(?&amp;lt;temp&amp;gt;^[A-Z]{3})"
| lookup TransctionDetails.csv Tran_lookup as temp OUTPUT Transaction_Details
| fields Count ,Tran, Transaction_Details, avgrt &lt;/LI-CODE&gt;&lt;P&gt;I extract the first three letters from the Tran field and put it in a separate field. Then I make the lookup against the file with the new field.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 12:11:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667675#M229054</guid>
      <dc:creator>FelixLeh</dc:creator>
      <dc:date>2023-11-07T12:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Stats and Look up</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667816#M229120</link>
      <description>&lt;P&gt;Thank you it worked.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 07:36:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-and-Look-up/m-p/667816#M229120</guid>
      <dc:creator>Satyapv</dc:creator>
      <dc:date>2023-11-08T07:36:23Z</dc:date>
    </item>
  </channel>
</rss>

