<?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: Get the roles from rest API and set to field in search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441116#M191185</link>
    <description>&lt;P&gt;Will this help? This will append rlss as a new column to your outside query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|appendcols [|rest /services/authentication/current-context|mvexpand roles |  eval rlss="\""+roles+","+username+"\"" | fields rlss]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Aug 2019 01:25:14 GMT</pubDate>
    <dc:creator>nareshinsvu</dc:creator>
    <dc:date>2019-08-09T01:25:14Z</dc:date>
    <item>
      <title>Get the roles from rest API and set to field in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441113#M191182</link>
      <description>&lt;P&gt;I need to get the roles assigned to current logged in user and set the value to filed in search.  Anybody has any idea. I tried the following and got the error.&lt;/P&gt;

&lt;P&gt;|makeresults|eval rls=[|rest /services/authentication/current-context |eval rls="\"".roles."\""|eval user="\"".username."\""|eval rlss=mvjoin(roles,",")|return $rlss]&lt;/P&gt;

&lt;P&gt;but got the error : Error in 'eval' command: Failed to parse the provided arguments. Usage: eval dest_key = expression &lt;BR /&gt;
not much details in logs.&lt;/P&gt;

&lt;P&gt;Anybody has any idea how to fix this? &lt;/P&gt;

&lt;P&gt;TIA.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 00:00:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441113#M191182</guid>
      <dc:creator>bhupalbobbadi</dc:creator>
      <dc:date>2019-08-09T00:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get the roles from rest API and set to field in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441114#M191183</link>
      <description>&lt;P&gt;Why can't rlss be your new field? No need to makeresult and append your results to another filed again. Are you not missing few roles with your sub-query? Can you try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rest /services/authentication/current-context|mvexpand roles | eval rlss="\""+roles+","+username+"\"" | fields rlss
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2019 00:31:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441114#M191183</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2019-08-09T00:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Get the roles from rest API and set to field in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441115#M191184</link>
      <description>&lt;P&gt;Thanks Naresh, Your query producing results, but my requirement is get and assign all roles (comma separated string value) for the current user and set it to a field in main query. &lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 00:52:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441115#M191184</guid>
      <dc:creator>bhupalbobbadi</dc:creator>
      <dc:date>2019-08-09T00:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Get the roles from rest API and set to field in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441116#M191185</link>
      <description>&lt;P&gt;Will this help? This will append rlss as a new column to your outside query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|appendcols [|rest /services/authentication/current-context|mvexpand roles |  eval rlss="\""+roles+","+username+"\"" | fields rlss]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2019 01:25:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441116#M191185</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2019-08-09T01:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get the roles from rest API and set to field in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441117#M191186</link>
      <description>&lt;P&gt;Alternatively if you want to do some comparisions with the subsearch, best way is to route the results to a lookup and then compare. Small example below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults [|rest /services/authentication/current-context|mvexpand roles |  eval rlss=+roles+","+username | fields rlss username | dedup  rlss| outputlookup rlss.csv] | eval mainuser="splunk-system-user" | lookup rlss.csv username as  mainuser
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2019 01:56:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-roles-from-rest-API-and-set-to-field-in-search/m-p/441117#M191186</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2019-08-09T01:56:28Z</dc:date>
    </item>
  </channel>
</rss>

