<?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: Join and read input from csv in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631801#M219456</link>
    <description>&lt;P&gt;I still don't get it, but maybe I don't need to - your search that searches your index for /enroll - isn't that giving you the latest date?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2023 07:38:04 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2023-02-22T07:38:04Z</dc:date>
    <item>
      <title>How to join and read input from csv?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631785#M219447</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I've a query&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="main" app="student-api" "tags.path"=/enroll "response"=succcess&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which also gives a trace_id&lt;/P&gt;
&lt;P&gt;and then I've&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="main" app="student-api"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which gives a student_id.&lt;/P&gt;
&lt;P&gt;I want to get the latest timestamp of enrollment (by joining the results) for each student_id (stored in a csv).&lt;/P&gt;
&lt;P&gt;The output would look like -&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;student_id| latest timestamp of enrollment&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Please suggest the steps to follow. I tried&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="main" app="student-api" tags.student_id | join type=inner trace_id
[| search index="main" app="student-api" "tags.path"="/enroll" "response"=success]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for the join, but it's not yielding the result. Also how to inputlookup the student_id from csv?&lt;/P&gt;
&lt;P&gt;Appreciate your help with this. Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 15:28:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631785#M219447</guid>
      <dc:creator>GhanaRusk</dc:creator>
      <dc:date>2023-02-22T15:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631791#M219448</link>
      <description>&lt;P&gt;It's not totally clear what 3 bits of data come from each place&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="main" app="student-api" tags.student_id&lt;/LI-CODE&gt;&lt;P&gt;gives you a student id AND a trace_id?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="main" app="student-api" "tags.path"="/enroll" "response"=success&lt;/LI-CODE&gt;&lt;P&gt;gives you a trace_id but no student id&lt;/P&gt;&lt;P&gt;What information do you need from this event if you plan to get the latest timestamp of enrollment from the CSV?&lt;/P&gt;&lt;P&gt;Its a good idea to avoid using join - normally you join datasets in Splunk with the stats command, e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="main" app="student-api" (tags.student_id OR "tags.path"="/enroll" response=success)
| stats values(student_id) as student_id
        max(eval(if("tags.path"="/enroll" AND response=success, _time, null()))) as last_enrollment by trace_id&lt;/LI-CODE&gt;&lt;P&gt;This searches both data sets and will give you the last time when an event had a successful enrollment for any given trace id and the value of any associated student id for that trace id.&lt;/P&gt;&lt;P&gt;If you want to look things up from a lookup file use&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup mylookup.csv student_id &lt;/LI-CODE&gt;&lt;P&gt;where student_id is a field in the lookup and your data&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 06:51:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631791#M219448</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-22T06:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631793#M219449</link>
      <description>&lt;LI-CODE lang="markup"&gt;index="main" app="student-api" tags.student_id
gives you a student id AND a trace_id?&lt;/LI-CODE&gt;&lt;P&gt;Correct&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="main" app="student-api" "tags.path"="/enroll" "response"=success
gives you a trace_id but no student id&lt;/LI-CODE&gt;&lt;P&gt;Correct&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;What information do you need from this event if you plan to get the latest timestamp of enrollment from the CSV?&lt;/LI-CODE&gt;&lt;P&gt;I get only the student_id from csv&lt;BR /&gt;&lt;BR /&gt;I want the latest date of successful enrollment&amp;nbsp; for a given student id.&lt;BR /&gt;&lt;BR /&gt;I'll give your query a try - thanks&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 07:04:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631793#M219449</guid>
      <dc:creator>GhanaRusk</dc:creator>
      <dc:date>2023-02-22T07:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631796#M219451</link>
      <description>&lt;P&gt;also inside if should those be == vs =?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 07:28:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631796#M219451</guid>
      <dc:creator>GhanaRusk</dc:creator>
      <dc:date>2023-02-22T07:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631797#M219452</link>
      <description>&lt;P&gt;You don't need to use ==&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 07:29:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631797#M219452</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-22T07:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631798#M219453</link>
      <description>&lt;P&gt;If you have the student id from the event search&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="main" app="student-api" tags.student_id&lt;/LI-CODE&gt;&lt;P&gt;what is your purpose for the CSV lookup?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 07:31:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631798#M219453</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-22T07:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631800#M219455</link>
      <description>&lt;P&gt;We'd like to get only the latest enrollment success dates for students in the csv&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 07:32:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631800#M219455</guid>
      <dc:creator>GhanaRusk</dc:creator>
      <dc:date>2023-02-22T07:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631801#M219456</link>
      <description>&lt;P&gt;I still don't get it, but maybe I don't need to - your search that searches your index for /enroll - isn't that giving you the latest date?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 07:38:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631801#M219456</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-22T07:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631803#M219458</link>
      <description>&lt;P&gt;I get -&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error in 'stats' command: The eval expression for dynamic field 'if("tags.path"="/enroll" AND "response"=success, _time, null())' is invalid. Error='Type checking failed. The '==' operator received different types.'.&lt;/LI-CODE&gt;&lt;P&gt;But if I do this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"tags.path"=="/enroll" AND "response"=="success"&lt;/LI-CODE&gt;&lt;P&gt;it gets past that error and runs.&lt;BR /&gt;&lt;BR /&gt;So to explain it say the csv has - student1 and student2&lt;BR /&gt;I'd like to get the latest enrollment date for those 2 students.&amp;nbsp;&lt;BR /&gt;Now, since&amp;nbsp;&lt;EM&gt;index="main" app="student-api" "tags.path"="/enroll" "response"=success&amp;nbsp;&lt;/EM&gt;doesn't allow us to filter by student_id, I am trying to get the trace_id from that query, join it with&amp;nbsp;&lt;EM&gt;index="main" app="student-api"&amp;nbsp;&lt;/EM&gt;(which allows us to filter by student_id)&amp;nbsp; based on that trace_id and then use the 2 ids from the csv to filter on that result.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 07:53:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631803#M219458</guid>
      <dc:creator>GhanaRusk</dc:creator>
      <dc:date>2023-02-22T07:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631808#M219460</link>
      <description>&lt;P&gt;The error was caused by not quoting "success", it should have been&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;max(eval(if("tags.path"="/enroll" AND response="success", _time, null())))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Feb 2023 08:17:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631808#M219460</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-22T08:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631811#M219463</link>
      <description>&lt;P&gt;thanks that was it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the query is not yielding any result still - curious where does it "join" by trace_id? is `&lt;SPAN&gt;by trace_id` on stats enough?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 08:45:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631811#M219463</guid>
      <dc:creator>GhanaRusk</dc:creator>
      <dc:date>2023-02-22T08:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: Join and read input from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631821#M219464</link>
      <description>&lt;P&gt;Please post an example of a data event and the search you are running - also please mask any sensitive information.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 09:42:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-and-read-input-from-csv/m-p/631821#M219464</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-22T09:42:43Z</dc:date>
    </item>
  </channel>
</rss>

