<?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 Why is the user shown in the results is not the user who is running the query? in Security</title>
    <link>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202650#M5864</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I wonder whether someone may be able to help me please.&lt;/P&gt;
&lt;P&gt;I'm running the query below to obtain information about searches that are being run on Splunk and the query works fine.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;|rest /services/search/jobs  
|rename custom.search as customSearch  
|search NOT author="splunk-system-user"  
|eval SearchString=if(isnotnull(customSearch),customSearch,eventSearch)  
|search SearchString!=""
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem I have is that the user shown in the results is not the user who is running the query, often through an app, but rather the owner of the app and developer of the query i.e. me.&lt;/P&gt;
&lt;P&gt;So I tried another query I found (see below) which does extract the person who is performing the search, but unlike the first query doesn't report the time range used and the duration of the search, well not that I can find.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;index=_audit action=search info=granted search=* NOT "search_id='scheduler" NOT "search='|history" NOT "user=splunk-system-user" NOT "search='typeahead" NOT "search='| metadata type=* | search totalCount&amp;gt;0" | stats count by user search _time | sort user | fields user search _time
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Could someone tell me please it possible to use a query which will retrieve the following data:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Owner of search&lt;/LI&gt;
&lt;LI&gt;User of search&lt;/LI&gt;
&lt;LI&gt;Search&lt;/LI&gt;
&lt;LI&gt;Date Range Used In Search&lt;/LI&gt;
&lt;LI&gt;Duration of the search&lt;/LI&gt;
&lt;LI&gt;App Used&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Many thanks and kind regards&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jun 2022 20:25:39 GMT</pubDate>
    <dc:creator>IRHM73</dc:creator>
    <dc:date>2022-06-29T20:25:39Z</dc:date>
    <item>
      <title>Why is the user shown in the results is not the user who is running the query?</title>
      <link>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202650#M5864</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I wonder whether someone may be able to help me please.&lt;/P&gt;
&lt;P&gt;I'm running the query below to obtain information about searches that are being run on Splunk and the query works fine.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;|rest /services/search/jobs  
|rename custom.search as customSearch  
|search NOT author="splunk-system-user"  
|eval SearchString=if(isnotnull(customSearch),customSearch,eventSearch)  
|search SearchString!=""
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem I have is that the user shown in the results is not the user who is running the query, often through an app, but rather the owner of the app and developer of the query i.e. me.&lt;/P&gt;
&lt;P&gt;So I tried another query I found (see below) which does extract the person who is performing the search, but unlike the first query doesn't report the time range used and the duration of the search, well not that I can find.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;index=_audit action=search info=granted search=* NOT "search_id='scheduler" NOT "search='|history" NOT "user=splunk-system-user" NOT "search='typeahead" NOT "search='| metadata type=* | search totalCount&amp;gt;0" | stats count by user search _time | sort user | fields user search _time
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Could someone tell me please it possible to use a query which will retrieve the following data:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Owner of search&lt;/LI&gt;
&lt;LI&gt;User of search&lt;/LI&gt;
&lt;LI&gt;Search&lt;/LI&gt;
&lt;LI&gt;Date Range Used In Search&lt;/LI&gt;
&lt;LI&gt;Duration of the search&lt;/LI&gt;
&lt;LI&gt;App Used&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Many thanks and kind regards&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 20:25:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202650#M5864</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2022-06-29T20:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Searches Run By User</title>
      <link>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202651#M5865</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Trying joining both queries with search_id and see if that helps:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_audit action=search info=granted search=* 
    NOT "search_id='scheduler" 
    NOT "search='|history" 
    NOT "user=splunk-system-user" 
    NOT "search='typeahead" 
    NOT "search='| metadata type=* | search totalCount&amp;gt;0"
| fields user, search, _time, search_id
| eval search_id = trim(replace(search_id, "\'", ""))
| join search_id [
    | rest /services/search/jobs
    | search NOT author="splunk-system-user"
    | rename custom.search as customSearch, sid AS search_id  
    | eval SearchString=if(isnotnull(customSearch),customSearch,eventSearch)  
    | search SearchString!=""
    | eval search_id = trim(replace(search_id, "\'", ""))
]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Feb 2016 10:00:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202651#M5865</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-12T10:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Searches Run By User</title>
      <link>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202652#M5866</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
try this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_audit action=search info=granted search=* NOT "search_id='scheduler" NOT "search='|history" NOT "user=splunk-system-user" NOT "search='typeahead" NOT "search='| metadata type=* | search totalCount&amp;gt;0" |table *

and specify certains information that you want for example see the following

index=_audit action=search info=granted search=* NOT "search_id='scheduler" NOT "search='|history" NOT "user=splunk-system-user" NOT "search='typeahead" NOT "search='| metadata type=* | search totalCount&amp;gt;0" |table user search maxtime timestamp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="![alt text][1]"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1052iF6CC941D6F22903A/image-size/large?v=v2&amp;amp;px=999" role="button" title="![alt text][1]" alt="![alt text][1]" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 10:05:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202652#M5866</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2016-02-12T10:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Searches Run By User</title>
      <link>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202653#M5867</link>
      <description>&lt;P&gt;Hi @javiergn, thank you for taking the time to come back to me with this and my apologies for not coming back to you sooner.&lt;/P&gt;

&lt;P&gt;The query works great and returns the information I need.&lt;/P&gt;

&lt;P&gt;Once again many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 13:57:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202653#M5867</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-15T13:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Searches Run By User</title>
      <link>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202654#M5868</link>
      <description>&lt;P&gt;Hi @chimell, thank you for taking the time to come back to me with this and my apologies for not replying sooner.&lt;/P&gt;

&lt;P&gt;The query works great.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 09:20:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202654#M5868</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-16T09:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Searches Run By User</title>
      <link>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202655#M5869</link>
      <description>&lt;P&gt;@Chimell&lt;BR /&gt;
Thanks a lot.Your query works great....&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2016 08:09:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/202655#M5869</guid>
      <dc:creator>josf999</dc:creator>
      <dc:date>2016-09-21T08:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Searches Run By User</title>
      <link>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/603849#M16201</link>
      <description>&lt;P&gt;This is a pretty complex problem - part of the puzzle is in the audit log's info="granted" event,&amp;nbsp; another part is in the audit log's info="completed" event,&amp;nbsp;&amp;nbsp; even more of it is over in the introspection index.&lt;/P&gt;&lt;P&gt;Then of course for jobs that still exist on the filesystem there is a wealth more info you can get from the rest command or by a custom search command that inspects info.csv and status.csv.&lt;/P&gt;&lt;P&gt;I recommend checking out an app that we released recently called Sideview UI -&amp;nbsp;&amp;nbsp; specifically the view within that app called "user_activity".&lt;/P&gt;&lt;P&gt;This will do all of this for you,&amp;nbsp; sidestep pretty thorny autokv problems in the audit data,&amp;nbsp; and not just give you all of this per search, but also present stats and rollups by user,&amp;nbsp; app, dashboard,&amp;nbsp;&amp;nbsp; even by sourcetypes-that-were-actually-searched&lt;BR /&gt;&lt;BR /&gt;it also has a macro called "calculate pain" that will score a "pain" number for each search, and then sum up all the "pain" in the by-user,&amp;nbsp; by-app,&amp;nbsp; by-sourcetype rollups etc.&amp;nbsp;&amp;nbsp; So that admins can try and pick off the worst offenders first.&lt;BR /&gt;&lt;BR /&gt;it's up on SB here and approved for both Cloud and onprem - &lt;A href="https://splunkbase.splunk.com/app/6449/" target="_blank"&gt;https://splunkbase.splunk.com/app/6449/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and there's a #sideview_ui channel for it in the community slack.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 18:47:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-is-the-user-shown-in-the-results-is-not-the-user-who-is/m-p/603849#M16201</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2022-06-29T18:47:14Z</dc:date>
    </item>
  </channel>
</rss>

