Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
511c8867
Commit
511c8867
authored
8 years ago
by
Sarath Subramanian
Committed by
Madhan Neethiraj
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1463: option to exclude specific entity attributes in audit records
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
75bcccd1
master
No related merge requests found
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
3 deletions
+94
-3
EntityAuditListener.java
...rg/apache/atlas/repository/audit/EntityAuditListener.java
+0
-0
EntityAuditRepository.java
.../apache/atlas/repository/audit/EntityAuditRepository.java
+14
-0
HBaseBasedAuditRepository.java
...che/atlas/repository/audit/HBaseBasedAuditRepository.java
+56
-3
InMemoryEntityAuditRepository.java
...atlas/repository/audit/InMemoryEntityAuditRepository.java
+10
-0
NoopEntityAuditRepository.java
...che/atlas/repository/audit/NoopEntityAuditRepository.java
+10
-0
StructInstance.java
...g/apache/atlas/typesystem/persistence/StructInstance.java
+4
-0
No files found.
repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java
View file @
511c8867
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditRepository.java
View file @
511c8867
...
@@ -50,4 +50,18 @@ public interface EntityAuditRepository {
...
@@ -50,4 +50,18 @@ public interface EntityAuditRepository {
* @throws AtlasException
* @throws AtlasException
*/
*/
List
<
EntityAuditEvent
>
listEvents
(
String
entityId
,
String
startKey
,
short
n
)
throws
AtlasException
;
List
<
EntityAuditEvent
>
listEvents
(
String
entityId
,
String
startKey
,
short
n
)
throws
AtlasException
;
/**
* Returns maximum allowed repository size per EntityAuditEvent
* @throws AtlasException
*/
long
repositoryMaxSize
()
throws
AtlasException
;
/**
* list of attributes to be excluded when storing in audit repo.
* @param entityType type of entity
* @return list of attribute names to be excluded
* @throws AtlasException
*/
List
<
String
>
getAuditExcludeAttributes
(
String
entityType
)
throws
AtlasException
;
}
}
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
View file @
511c8867
...
@@ -52,8 +52,10 @@ import java.io.Closeable;
...
@@ -52,8 +52,10 @@ import java.io.Closeable;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* HBase based repository for entity audit events
* HBase based repository for entity audit events
...
@@ -74,9 +76,6 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
...
@@ -74,9 +76,6 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
public
static
final
String
CONFIG_PREFIX
=
"atlas.audit"
;
public
static
final
String
CONFIG_PREFIX
=
"atlas.audit"
;
public
static
final
String
CONFIG_TABLE_NAME
=
CONFIG_PREFIX
+
".hbase.tablename"
;
public
static
final
String
CONFIG_TABLE_NAME
=
CONFIG_PREFIX
+
".hbase.tablename"
;
public
static
final
String
DEFAULT_TABLE_NAME
=
"ATLAS_ENTITY_AUDIT_EVENTS"
;
public
static
final
String
DEFAULT_TABLE_NAME
=
"ATLAS_ENTITY_AUDIT_EVENTS"
;
private
static
final
String
FIELD_SEPARATOR
=
":"
;
public
static
final
String
CONFIG_PERSIST_ENTITY_DEFINITION
=
CONFIG_PREFIX
+
".persistEntityDefinition"
;
public
static
final
String
CONFIG_PERSIST_ENTITY_DEFINITION
=
CONFIG_PREFIX
+
".persistEntityDefinition"
;
public
static
final
byte
[]
COLUMN_FAMILY
=
Bytes
.
toBytes
(
"dt"
);
public
static
final
byte
[]
COLUMN_FAMILY
=
Bytes
.
toBytes
(
"dt"
);
...
@@ -85,8 +84,16 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
...
@@ -85,8 +84,16 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
public
static
final
byte
[]
COLUMN_USER
=
Bytes
.
toBytes
(
"u"
);
public
static
final
byte
[]
COLUMN_USER
=
Bytes
.
toBytes
(
"u"
);
public
static
final
byte
[]
COLUMN_DEFINITION
=
Bytes
.
toBytes
(
"f"
);
public
static
final
byte
[]
COLUMN_DEFINITION
=
Bytes
.
toBytes
(
"f"
);
private
static
final
String
AUDIT_REPOSITORY_MAX_SIZE_PROPERTY
=
"atlas.hbase.client.keyvalue.maxsize"
;
private
static
final
String
AUDIT_EXCLUDE_ATTRIBUTE_PROPERTY
=
"atlas.audit.hbase.entity"
;
private
static
final
String
FIELD_SEPARATOR
=
":"
;
private
static
final
long
ATLAS_HBASE_KEYVALUE_DEFAULT_SIZE
=
1024
*
1024
;
private
static
Configuration
APPLICATION_PROPERTIES
=
null
;
private
static
boolean
persistEntityDefinition
;
private
static
boolean
persistEntityDefinition
;
private
Map
<
String
,
List
<
String
>>
auditExcludedAttributesCache
=
new
HashMap
<>();
static
{
static
{
try
{
try
{
persistEntityDefinition
=
ApplicationProperties
.
get
().
getBoolean
(
CONFIG_PERSIST_ENTITY_DEFINITION
,
false
);
persistEntityDefinition
=
ApplicationProperties
.
get
().
getBoolean
(
CONFIG_PERSIST_ENTITY_DEFINITION
,
false
);
...
@@ -219,6 +226,52 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
...
@@ -219,6 +226,52 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
}
}
}
}
@Override
public
long
repositoryMaxSize
()
throws
AtlasException
{
long
ret
;
initApplicationProperties
();
if
(
APPLICATION_PROPERTIES
==
null
)
{
ret
=
ATLAS_HBASE_KEYVALUE_DEFAULT_SIZE
;
}
else
{
ret
=
APPLICATION_PROPERTIES
.
getLong
(
AUDIT_REPOSITORY_MAX_SIZE_PROPERTY
,
ATLAS_HBASE_KEYVALUE_DEFAULT_SIZE
);
}
return
ret
;
}
@Override
public
List
<
String
>
getAuditExcludeAttributes
(
String
entityType
)
throws
AtlasException
{
List
<
String
>
ret
=
null
;
initApplicationProperties
();
if
(
auditExcludedAttributesCache
.
containsKey
(
entityType
))
{
ret
=
auditExcludedAttributesCache
.
get
(
entityType
);
}
else
if
(
APPLICATION_PROPERTIES
!=
null
)
{
String
[]
excludeAttributes
=
APPLICATION_PROPERTIES
.
getStringArray
(
AUDIT_EXCLUDE_ATTRIBUTE_PROPERTY
+
"."
+
entityType
+
"."
+
"attributes.exclude"
);
if
(
excludeAttributes
!=
null
)
{
ret
=
Arrays
.
asList
(
excludeAttributes
);
}
auditExcludedAttributesCache
.
put
(
entityType
,
ret
);
}
return
ret
;
}
private
void
initApplicationProperties
()
{
if
(
APPLICATION_PROPERTIES
==
null
)
{
try
{
APPLICATION_PROPERTIES
=
ApplicationProperties
.
get
();
}
catch
(
AtlasException
ex
)
{
// ignore
}
}
}
private
String
getResultString
(
Result
result
,
byte
[]
columnName
)
{
private
String
getResultString
(
Result
result
,
byte
[]
columnName
)
{
byte
[]
rawValue
=
result
.
getValue
(
COLUMN_FAMILY
,
columnName
);
byte
[]
rawValue
=
result
.
getValue
(
COLUMN_FAMILY
,
columnName
);
if
(
rawValue
!=
null
)
{
if
(
rawValue
!=
null
)
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/audit/InMemoryEntityAuditRepository.java
View file @
511c8867
...
@@ -66,4 +66,14 @@ public class InMemoryEntityAuditRepository implements EntityAuditRepository {
...
@@ -66,4 +66,14 @@ public class InMemoryEntityAuditRepository implements EntityAuditRepository {
}
}
return
events
;
return
events
;
}
}
@Override
public
long
repositoryMaxSize
()
throws
AtlasException
{
return
-
1
;
}
@Override
public
List
<
String
>
getAuditExcludeAttributes
(
String
entityType
)
throws
AtlasException
{
return
null
;
}
}
}
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/audit/NoopEntityAuditRepository.java
View file @
511c8867
...
@@ -47,4 +47,14 @@ public class NoopEntityAuditRepository implements EntityAuditRepository {
...
@@ -47,4 +47,14 @@ public class NoopEntityAuditRepository implements EntityAuditRepository {
throws
AtlasException
{
throws
AtlasException
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
@Override
public
long
repositoryMaxSize
()
throws
AtlasException
{
return
-
1
;
}
@Override
public
List
<
String
>
getAuditExcludeAttributes
(
String
entityType
)
throws
AtlasException
{
return
null
;
}
}
}
This diff is collapsed.
Click to expand it.
typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
View file @
511c8867
...
@@ -254,6 +254,10 @@ public class StructInstance implements ITypedStruct {
...
@@ -254,6 +254,10 @@ public class StructInstance implements ITypedStruct {
bigDecimals
[
pos
]
=
null
;
bigDecimals
[
pos
]
=
null
;
}
else
if
(
i
.
dataType
()
==
DataTypes
.
DATE_TYPE
)
{
}
else
if
(
i
.
dataType
()
==
DataTypes
.
DATE_TYPE
)
{
dates
[
pos
]
=
null
;
dates
[
pos
]
=
null
;
}
else
if
(
i
.
dataType
()
==
DataTypes
.
INT_TYPE
)
{
ints
[
pos
]
=
0
;
}
else
if
(
i
.
dataType
()
==
DataTypes
.
BOOLEAN_TYPE
)
{
bools
[
pos
]
=
false
;
}
else
if
(
i
.
dataType
()
==
DataTypes
.
STRING_TYPE
)
{
}
else
if
(
i
.
dataType
()
==
DataTypes
.
STRING_TYPE
)
{
strings
[
pos
]
=
null
;
strings
[
pos
]
=
null
;
}
else
if
(
i
.
dataType
().
getTypeCategory
()
==
DataTypes
.
TypeCategory
.
ARRAY
)
{
}
else
if
(
i
.
dataType
().
getTypeCategory
()
==
DataTypes
.
TypeCategory
.
ARRAY
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment