<?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: How to use K-anonymity with Splunk? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-K-anonymity-with-Splunk/m-p/347864#M63877</link>
    <description>&lt;P&gt;I don't understand the reason for your business case, but here is what I would do to achieve your stated objective. Instead of running it through a standard indexing, I would bring it in, aggregate it, and then collect the aggregated data into a summary index.   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | inputcsv mystuff.csv 

   | rename COMMENT as "Assign every pair of records to a group, then stats the group together " 
   | streamstats count as recno
   | eval groupno = floor( ( 1+ recno ) / 2 )
   | stats list(User) as User list(Age) as Age by groupno

   | rename COMMENT as "Set time, Get rid of unneeded fields, then copy them to the new index."
   | eval _time = now() 
   | table _time User Age 
   | collect .... send to desired index... 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to break the link of order between each &lt;CODE&gt;User&lt;/CODE&gt; and his &lt;CODE&gt;Age&lt;/CODE&gt;, then do this to sort the fields after the &lt;CODE&gt;stats&lt;/CODE&gt; command.  This will break the relationship between any individual Age and its User.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | stats list(User) as User list(Age) as Age by groupno
   | eval User=mvsort(User)
   | eval Age=mvsort(Age) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to change the number of records in each group to some number K, change line 5 to use your new K-1 and K as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | eval groupno = floor( ( K-1 + recno ) / K )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Updated to remove suggestion to use &lt;CODE&gt;values&lt;/CODE&gt;, since that would delete duplicates.  &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;There is also an issue with this anonymization method if using K=2 or k=3 and all of the Users have the same Age. Sigh.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | inputcsv mystuff.csv 

   | rename COMMENT as "make sure that no two of the same Age are sequential." 
   | streamstats count as ageno by Age
   | eventstats count as totalcount 
   | eventstats max(ageno) as agecount by Age
   | eval myorder=round((ageno-0.5)/agecount,2)
   | sort 0 myorder User

   | rename COMMENT as "Assign every pair of records to a group, then stats the group together " 
   | streamstats count as recno
   | eval groupno = floor( ( 1+ recno ) / 2 )
   | stats list(User) as User list(Age) as Age by groupno

   | rename COMMENT as "Set time, Get rid of unneeded fields, then copy them to the new index."
   | eval _time = now() 
   | table _time User Age 
   | collect .... send to desired index... 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To work, the above depends on no one Age predominating in the data set.   &lt;/P&gt;</description>
    <pubDate>Mon, 25 Sep 2017 15:19:09 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-09-25T15:19:09Z</dc:date>
    <item>
      <title>How to use K-anonymity with Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-K-anonymity-with-Splunk/m-p/347863#M63876</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
Let's say i have a csv file that contains sensitive data, I want on index to group multiple lines as one event in a way that it doesnt compromise my data. So let's say:&lt;BR /&gt;
User - Age&lt;BR /&gt;
U1    - 12&lt;BR /&gt;
U2    - 13&lt;BR /&gt;
U3    - 17&lt;BR /&gt;
U4    - 15&lt;BR /&gt;
U5    - 20&lt;BR /&gt;
How can I group for example each 2 users as one event as so(of course before indexing and not on search time):&lt;BR /&gt;
U1,U2 - 12,13&lt;BR /&gt;
U3,U4 - 17-15&lt;BR /&gt;
...&lt;BR /&gt;
Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 12:21:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-K-anonymity-with-Splunk/m-p/347863#M63876</guid>
      <dc:creator>MarcHelou</dc:creator>
      <dc:date>2017-09-25T12:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use K-anonymity with Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-K-anonymity-with-Splunk/m-p/347864#M63877</link>
      <description>&lt;P&gt;I don't understand the reason for your business case, but here is what I would do to achieve your stated objective. Instead of running it through a standard indexing, I would bring it in, aggregate it, and then collect the aggregated data into a summary index.   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | inputcsv mystuff.csv 

   | rename COMMENT as "Assign every pair of records to a group, then stats the group together " 
   | streamstats count as recno
   | eval groupno = floor( ( 1+ recno ) / 2 )
   | stats list(User) as User list(Age) as Age by groupno

   | rename COMMENT as "Set time, Get rid of unneeded fields, then copy them to the new index."
   | eval _time = now() 
   | table _time User Age 
   | collect .... send to desired index... 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to break the link of order between each &lt;CODE&gt;User&lt;/CODE&gt; and his &lt;CODE&gt;Age&lt;/CODE&gt;, then do this to sort the fields after the &lt;CODE&gt;stats&lt;/CODE&gt; command.  This will break the relationship between any individual Age and its User.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | stats list(User) as User list(Age) as Age by groupno
   | eval User=mvsort(User)
   | eval Age=mvsort(Age) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to change the number of records in each group to some number K, change line 5 to use your new K-1 and K as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | eval groupno = floor( ( K-1 + recno ) / K )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Updated to remove suggestion to use &lt;CODE&gt;values&lt;/CODE&gt;, since that would delete duplicates.  &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;There is also an issue with this anonymization method if using K=2 or k=3 and all of the Users have the same Age. Sigh.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | inputcsv mystuff.csv 

   | rename COMMENT as "make sure that no two of the same Age are sequential." 
   | streamstats count as ageno by Age
   | eventstats count as totalcount 
   | eventstats max(ageno) as agecount by Age
   | eval myorder=round((ageno-0.5)/agecount,2)
   | sort 0 myorder User

   | rename COMMENT as "Assign every pair of records to a group, then stats the group together " 
   | streamstats count as recno
   | eval groupno = floor( ( 1+ recno ) / 2 )
   | stats list(User) as User list(Age) as Age by groupno

   | rename COMMENT as "Set time, Get rid of unneeded fields, then copy them to the new index."
   | eval _time = now() 
   | table _time User Age 
   | collect .... send to desired index... 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To work, the above depends on no one Age predominating in the data set.   &lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 15:19:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-K-anonymity-with-Splunk/m-p/347864#M63877</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-25T15:19:09Z</dc:date>
    </item>
  </channel>
</rss>

