<?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: resolving username from uid in a splunk query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545190#M154393</link>
    <description>&lt;P&gt;Only issue with that from what I see is if there is no value in the table for uid lookup, then nothing is returned. Which means that possibly an unresolved audit record will not be shown in the table. I was going to enhance my python script to return the uid if the lookup was unsuccessful, so at least the unresolved uid would be shown in the query.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Mar 2021 17:06:09 GMT</pubDate>
    <dc:creator>mullica1</dc:creator>
    <dc:date>2021-03-24T17:06:09Z</dc:date>
    <item>
      <title>resolving username from uid in a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545121#M154370</link>
      <description>&lt;P&gt;Greetings-&lt;/P&gt;&lt;P&gt;I'm putting together a dashboard query that shows uid's and systems as a result. I would like to resolve that uid to a username, so the the dashboard output will be username and system. I have written a python script that when passed uid will return the username. What I'm stumbling with is calling it correctly and using the output. I've tried calling it as a script and a lookup, verified it is running but can't get it to do what I want. Can someone give me a shove in the right direction please?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 12:54:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545121#M154370</guid>
      <dc:creator>mullica1</dc:creator>
      <dc:date>2021-03-24T12:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: resolving username from uid in a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545154#M154379</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/22483"&gt;@mullica1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;The best way to do is create a lookup file that contains all uid, system and usernames. You can update this lookup using your script with crontab. And use that lookup at the end of your dashboard search like below sample;&lt;/P&gt;&lt;P&gt;Lookup file sample;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;uid_lookup.csv

uid,system,username
1001,host1,user1&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;| lookup uid_lookup.csv uid system OUTPUT username
| table username system&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 14:28:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545154#M154379</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-03-24T14:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: resolving username from uid in a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545158#M154380</link>
      <description>&lt;P&gt;An external lookup should do the job.&amp;nbsp; Have you looked at&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.3/Knowledge/Configureexternallookups" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.3/Knowledge/Configureexternallookups&lt;/A&gt;&amp;nbsp;?&lt;/P&gt;&lt;P&gt;Please explain what you want it to do and what it is actually doing.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 17:19:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545158#M154380</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-03-24T17:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: resolving username from uid in a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545173#M154384</link>
      <description>&lt;P&gt;Thanks I'll check the link, I've read till my eyes have bled.&lt;/P&gt;&lt;P&gt;Here's what I'm doing. A dashboard query similar to&lt;/P&gt;&lt;P&gt;sourcetype=linux_audit............. | stats by uid,host&lt;/P&gt;&lt;P&gt;which gives me a table of uid and hosts. Unfortunately the audit records in question don't have the user account name, just the uid. What I want to do is turn that table into user, host by passing the uid's to a python script like&lt;/P&gt;&lt;P&gt;import sys&lt;/P&gt;&lt;P&gt;import pwd&lt;/P&gt;&lt;P&gt;arg=int(sys.argv[1])&lt;/P&gt;&lt;P&gt;results=pwd.getpwuid(arg).pw_name&lt;/P&gt;&lt;P&gt;print(results)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My python scripts works as expected and I can call it from the command line with the expected results. I made an entry in transforms.conf.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what's tripping me up is how to invoke it correctly.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 15:27:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545173#M154384</guid>
      <dc:creator>mullica1</dc:creator>
      <dc:date>2021-03-24T15:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: resolving username from uid in a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545190#M154393</link>
      <description>&lt;P&gt;Only issue with that from what I see is if there is no value in the table for uid lookup, then nothing is returned. Which means that possibly an unresolved audit record will not be shown in the table. I was going to enhance my python script to return the uid if the lookup was unsuccessful, so at least the unresolved uid would be shown in the query.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 17:06:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545190#M154393</guid>
      <dc:creator>mullica1</dc:creator>
      <dc:date>2021-03-24T17:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: resolving username from uid in a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545192#M154394</link>
      <description>&lt;P&gt;Just proved myself wrong, I can user coalesce.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eval account=coalesce(account,uid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if not found it will just list the uid. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 17:21:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545192#M154394</guid>
      <dc:creator>mullica1</dc:creator>
      <dc:date>2021-03-24T17:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: resolving username from uid in a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545193#M154395</link>
      <description>&lt;P&gt;One cannot invoke an ordinary Python script from SPL.&amp;nbsp; There is a protocol that Splunk uses to communicate with the script. Learn more at dev.splunk.com.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 17:21:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/resolving-username-from-uid-in-a-splunk-query/m-p/545193#M154395</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-03-24T17:21:55Z</dc:date>
    </item>
  </channel>
</rss>

