<?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: Restrict Search Terms Conditionally Depending On The Index Being Searched in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Restrict-Search-Terms-Conditionally-Depending-On-The-Index-Being/m-p/32745#M6870</link>
    <description>&lt;P&gt;I have confirmed this in fact does work. I only tested it briefly but it seemed to work perfectly. If a user is assigned multiple roles like I described above, it effectively turns a user's access on / off for those data types. I'm not sure how much it would affect performances but at first glance it seemed fine. I'll report back more after I've done some more testing.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Feb 2013 03:55:23 GMT</pubDate>
    <dc:creator>jpass</dc:creator>
    <dc:date>2013-02-19T03:55:23Z</dc:date>
    <item>
      <title>Restrict Search Terms Conditionally Depending On The Index Being Searched</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Restrict-Search-Terms-Conditionally-Depending-On-The-Index-Being/m-p/32742#M6867</link>
      <description>&lt;P&gt;I have multiple indexes to help control user access to data. Now I've run into a situation where data within an index needs to be further divided into access levels. &lt;/P&gt;

&lt;P&gt;Here's the structure:&lt;/P&gt;

&lt;P&gt;index=i1 foo=bar foo1=bar1&lt;BR /&gt;
index=i2 type=t1&lt;BR /&gt;
index=i2 type=t2&lt;BR /&gt;
index=i2 type=t3&lt;BR /&gt;
index=i3 &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Goal: Allow user1 full access to i1 &amp;amp; i3 but only type 't1' in the i2 index&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;my current roles configuration&lt;/STRONG&gt;&lt;BR /&gt;
role_i1 - provides full access to index 1&lt;BR /&gt;
role_i2 - provides full access to index 2&lt;BR /&gt;
role_i3 - provides full access to index 3&lt;/P&gt;

&lt;P&gt;My first inclination was to create a new role:&lt;BR /&gt;
role_i2_t1 = provides access to index i2 but uses the 'restrict search terms' field to say 'type=t1'&lt;/P&gt;

&lt;P&gt;So user1 roles configuration would be as follows:&lt;BR /&gt;
user1 (role_i1,role_i2_t1,role_i3)&lt;/P&gt;

&lt;P&gt;This works fine for restricting access within the i2 index. But the side affect is that, because the other index do not contain a field called 'type', users can not return any search results.&lt;/P&gt;

&lt;P&gt;So my questions:&lt;BR /&gt;
 1. maybe I'm misunderstanding or doing something wrong and my approach is the correct one&lt;BR /&gt;
 2. Or I'm correct in my findings and another route needs to be take&lt;BR /&gt;
 3. The only other option I see thus far is to create an index for each 'type' and use continue to use roles to manage access to specific data&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:19:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Restrict-Search-Terms-Conditionally-Depending-On-The-Index-Being/m-p/32742#M6867</guid>
      <dc:creator>jpass</dc:creator>
      <dc:date>2020-09-28T13:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict Search Terms Conditionally Depending On The Index Being Searched</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Restrict-Search-Terms-Conditionally-Depending-On-The-Index-Being/m-p/32743#M6868</link>
      <description>&lt;P&gt;I think your 'restrict search times = "type=t1"' is not correct. Could you try following?&lt;/P&gt;

&lt;P&gt;index=i1 OR index=i3 OR ( index=i2 AND type=t1 )&lt;/P&gt;

&lt;P&gt;As you recognized, the other index does not have type field. You will need to specify each index and field explicitly.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2013 07:22:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Restrict-Search-Terms-Conditionally-Depending-On-The-Index-Being/m-p/32743#M6868</guid>
      <dc:creator>Takajian</dc:creator>
      <dc:date>2013-02-15T07:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict Search Terms Conditionally Depending On The Index Being Searched</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Restrict-Search-Terms-Conditionally-Depending-On-The-Index-Being/m-p/32744#M6869</link>
      <description>&lt;P&gt;I selected Takajian's answer but provided a modified version and some more details for discussion.&lt;/P&gt;

&lt;P&gt;Yup. That's it. Man I must have been up too long or something because simple search logic took care of this issue.&lt;/P&gt;

&lt;P&gt;I did modify my approach a bit though to make the string shorter:&lt;/P&gt;

&lt;P&gt;index!=i2 OR (index=i2 AND type=t1)&lt;/P&gt;

&lt;P&gt;This way if you have a bunch of indexes you don't have to list each one.&lt;/P&gt;

&lt;P&gt;Do you see a problem using this method if each index has sub groups under different field names?&lt;/P&gt;

&lt;H2&gt;For example:&lt;/H2&gt;

&lt;P&gt;index=i1 color=c1 OR color=c2 OR color=c3&lt;BR /&gt;
index=i2 type=t1 OR type=t2 OR type=t3&lt;/P&gt;

&lt;H2&gt;index=i3 size=s1 OR size=s2 OR size=s3&lt;/H2&gt;

&lt;P&gt;My roles would have to overlap.&lt;/P&gt;

&lt;P&gt;role_i1_c1 = index!=i1 OR (index=i1 AND color=c1)&lt;BR /&gt;
role_i1_c2 = index!=i1 OR (index=i1 AND color=c2)&lt;BR /&gt;
role_i1_c3 = index!=i1 OR (index=i1 AND color=c3)&lt;/P&gt;

&lt;P&gt;role_i2_t1 = index!=i2 OR (index=i2 AND type=t1)&lt;BR /&gt;
role_i2_t2 = index!=i2 OR (index=i2 AND type=t2)&lt;BR /&gt;
role_i2_t3 = index!=i2 OR (index=i2 AND type=t3)&lt;/P&gt;

&lt;P&gt;role_i3_s1 = index!=i3 OR (index=i3 AND type=s1)&lt;BR /&gt;
role_i3_s2 = index!=i3 OR (index=i3 AND type=s2)&lt;/P&gt;

&lt;H2&gt;role_i3_s3 = index!=i3 OR (index=i3 AND type=s3)&lt;/H2&gt;

&lt;P&gt;Example user1: can access index i1 color c1 and c3 &amp;amp; index i3 size s2&lt;/P&gt;

&lt;P&gt;user1 roles assignment: role_i1_c1, role_i1_c3, role_i3_s1&lt;/P&gt;

&lt;P&gt;Or would it be easier to just create a bunch of indexes for each sub-group?&lt;/P&gt;

&lt;P&gt;FYI:&lt;BR /&gt;
i1 currently has 20 colors&lt;BR /&gt;
i2 has about 30 types&lt;BR /&gt;
i3 has 4 sizes&lt;/P&gt;

&lt;P&gt;Thanks for your time.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:19:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Restrict-Search-Terms-Conditionally-Depending-On-The-Index-Being/m-p/32744#M6869</guid>
      <dc:creator>jpass</dc:creator>
      <dc:date>2020-09-28T13:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict Search Terms Conditionally Depending On The Index Being Searched</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Restrict-Search-Terms-Conditionally-Depending-On-The-Index-Being/m-p/32745#M6870</link>
      <description>&lt;P&gt;I have confirmed this in fact does work. I only tested it briefly but it seemed to work perfectly. If a user is assigned multiple roles like I described above, it effectively turns a user's access on / off for those data types. I'm not sure how much it would affect performances but at first glance it seemed fine. I'll report back more after I've done some more testing.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Feb 2013 03:55:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Restrict-Search-Terms-Conditionally-Depending-On-The-Index-Being/m-p/32745#M6870</guid>
      <dc:creator>jpass</dc:creator>
      <dc:date>2013-02-19T03:55:23Z</dc:date>
    </item>
  </channel>
</rss>

