Skip to content

Commit 4b018aa

Browse files
authored
[Config] Update 'Audit log' to using a new config (#3983)
* Updated and restructured Audit module page * Documented new audit log fields - uuid, severity * Added a new Severity level subsection to Custom events section (with examples) * Added audit_log reference section: - audit_log.extract_key, audit_log.spaces - new options - other options are moved from the box.cfg reference * Fixed typo in the tt search description Fixes #3667 Fixes tarantool/enterprise_doc#258 Fixes tarantool/enterprise_doc#257 Fixes tarantool/enterprise_doc#221 Fixes tarantool/enterprise_doc#248
1 parent 14909d2 commit 4b018aa

File tree

10 files changed

+852
-477
lines changed

10 files changed

+852
-477
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
audit_log:
2+
to: file
3+
file: 'audit_tarantool.log'
4+
filter: [ user_create,data_operations,ddl,custom ]
5+
format: json
6+
spaces: [ bands ]
7+
extract_key: true
8+
9+
groups:
10+
group001:
11+
replicasets:
12+
replicaset001:
13+
instances:
14+
instance001:
15+
iproto:
16+
listen:
17+
- uri: '127.0.0.1:3301'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
instance001:
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
-- myapp.lua --
2+
3+
-- Create space
4+
function create_space()
5+
box.schema.space.create('bands')
6+
box.space.bands:format({
7+
{ name = 'id', type = 'unsigned' },
8+
{ name = 'band_name', type = 'string' },
9+
{ name = 'year', type = 'unsigned' }
10+
})
11+
box.space.bands:create_index('primary', { type = "tree", parts = { 'id' } })
12+
box.space.bands:create_index('secondary', { type = "tree", parts = { 'band_name' } })
13+
box.schema.user.grant('guest', 'read,write,execute', 'universe')
14+
end
15+
-- Insert data
16+
function load_data()
17+
box.space.bands:insert { 1, 'Roxette', 1986 }
18+
box.space.bands:insert { 2, 'Scorpions', 1965 }
19+
end
20+
21+
local audit = require('audit')
22+
-- Log message string
23+
audit.log('Hello, Alice!')
24+
-- Log format string and arguments
25+
audit.log('Hello, %s!', 'Bob')
26+
-- Log table with audit log field values
27+
audit.log({ type = 'custom_hello', description = 'Hello, World!' })
28+
audit.log({ type = 'custom_farewell', user = 'eve', module = 'custom', description = 'Farewell, Eve!' })
29+
-- Create a new log module
30+
local my_audit = audit.new({ type = 'custom_hello', module = 'my_module' })
31+
my_audit:log('Hello, Alice!')
32+
my_audit:log({ tag = 'admin', description = 'Hello, Bob!' })
33+
34+
-- Log 'Hello!' message with the VERBOSE severity level
35+
audit.log({ severity = 'VERBOSE', description = 'Hello!' })
36+
37+
-- Log 'Hello!' message with a shortcut helper function
38+
audit.verbose('Hello!')
39+
40+
-- Like audit.log(), a shortcut helper function accepts a table of options
41+
audit.verbose({ description = 'Hello!' })
42+
43+
-- Severity levels are available for custom loggers
44+
local my_logger = audit.new({ module = 'my_module' })
45+
my_logger:log({ severity = 'ALARM', description = 'Alarm' })
46+
my_logger:alarm('Alarm')
47+
48+
-- Overwrite session_type and remote fields
49+
audit.log({ type = 'custom_hello', description = 'Hello!',
50+
session_type = 'my_session', remote = 'my_remote' })
51+
-- End
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
audit_log:
2+
to: pipe
3+
pipe: '| cronolog audit_tarantool.log'
4+
5+
groups:
6+
group001:
7+
replicasets:
8+
replicaset001:
9+
instances:
10+
instance001:
11+
iproto:
12+
listen:
13+
- uri: '127.0.0.1:3301'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
instance001:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
audit_log:
2+
to: syslog
3+
syslog_server: 'unix:/dev/log'
4+
syslog_facility: 'user'
5+
syslog_identity: 'tarantool'
6+
filter: 'audit,auth,priv,password_change,access_denied'
7+
extract_key: false
8+
9+
groups:
10+
group001:
11+
iproto:
12+
listen:
13+
- uri: '127.0.0.1:3301'
14+
replicasets:
15+
replicaset001:
16+
instances:
17+
instance001:
18+
iproto:
19+
listen:
20+
- uri: '127.0.0.1:3301'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
instance001:

0 commit comments

Comments
 (0)