I'm looking for a solution to get data from two CSV files that will be used for a one-off search.
I have the following data:
What I want to do is get combine CSV2 with CSV1 (easy) and then find the person's manager's full name with nothing more than the ManagerRACF field (unknown).
For the first part:
source=CSV1.csv |join displayName[search index="main" source="CSV2.csv" | eval displayName=First_Name." ".Last_Name |dedup displayName| fields + displayName] | table displayName, ManagerRACF, ManagerName, Token_Nr
This will join the two files and show the user's full name, the Manager's UserID and the user's Token number.
Now how do i get ManagerName to translate into the full name of the person's manager from CSV 1 based on the data in the ManagerRACF column? Basically what this means is, I need to find data in ManagerRACF (Jdoe002) search the sAMAccountName column for that value, and then return the results from displayName on that row into the ManagerName column.
I see that you indexed this data into Splunk, but honestly this doesn't seem like the best way to approach the problem. I think that CSV 1 (can we call it "AccountInfo") should be a lookup table, not indexed into Splunk.
source=csv2 | eval displayName = First_Name + " " + Last_Name | lookup AccountLookup displayName OUTPUT ManagerRACF as inRACF | lookup AccountLookup sAMAccountName as inRACF OUTPUT displayName as ManagerName
That should do it!
Yep, along my line of thinking as well. Actually both of the CSV's are pretty good candidates for lookup tables, and in my opinion CSV2 is preferable, as you tend to change managers more often than you change your name 🙂
Imagine there is a table with two rows:
displayName, sAMAccountName, ManagerRACF, Token_Nr
John Doe, JDoe001, JDoe002, 000000001
Jane Doe, JDoe002, JDoe003, 000000002
Splunk should return the results as follows:
displayName, ManagerRACF, ManagerName, Token_Nr
John Doe, JDoe002, Jane Doe, 000000001
The displayName value from row 2 populates "ManagerName" value field in splunk, based on the data in the "ManagerRACF" value field from row 1.