Skip to content

Commit 849bb3d

Browse files
committed
audit log: apply review suggestions
1 parent f615a13 commit 849bb3d

File tree

4 files changed

+30
-48
lines changed

4 files changed

+30
-48
lines changed

doc/code_snippets/snippets/config/instances.enabled/audit_log/myapp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
-- Create space
44
function create_space()
5-
box.schema.space.create('Bands')
5+
box.schema.space.create('bands')
66
box.space.bands:format({
77
{ name = 'id', type = 'unsigned' },
88
{ name = 'band_name', type = 'string' },

doc/code_snippets/snippets/config/instances.enabled/audit_log_syslog/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
audit_log:
22
to: syslog
33
syslog_server: 'unix:/dev/log'
4-
syslog_facility: user
4+
syslog_facility: 'user'
55
syslog_identity: 'tarantool'
66
filter: 'audit,auth,priv,password_change,access_denied'
77
extract_key: false

doc/enterprise/audit_log.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,15 @@ forces the audit subsystem to log the primary key instead of a full tuple in DML
149149
Examples of audit log entries
150150
-----------------------------
151151

152-
In the example, the logs are written to the ``audit_tarantool.log`` file.
152+
In this example, the following audit log configuration is used:
153153

154-
First, create a space ``bands`` and check the logs in the file after the creation:
154+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/audit_log/config.yaml
155+
:language: yaml
156+
:start-at: audit_log
157+
:end-at: extract_key: true
158+
:dedent:
159+
160+
Create a space ``bands`` and check the logs in the file after the creation:
155161

156162
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/audit_log/myapp.lua
157163
:language: lua
@@ -611,12 +617,10 @@ Tips
611617
How many events can be recorded?
612618
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
613619

614-
If you write to a file, the size of the Tarantool audit module is limited by the disk space.
615-
If you write to a system logger, the size of the Tarantool audit module is limited by the system logger.
616-
If you write to a pipe, the size of the Tarantool audit module is limited by the system buffer.
620+
If you write to a file, the size of the Tarantool audit log is limited by the disk space.
621+
If you write to a system logger, the size of the Tarantool audit log is limited by the system logger.
622+
If you write to a pipe, the size of the Tarantool audit message is limited by the system buffer.
617623
If the ``audit_log.nonblock = false``, if ``audit_log.nonblock`` = ``true``, there is no limit.
618-
However, it is not recommended to use the entire memory, as this may cause performance degradation
619-
and even loss of some logs.
620624

621625
How often should audit logs be reviewed?
622626
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

doc/reference/configuration/configuration_reference.rst

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,17 @@ The ``audit_log`` section defines configuration parameters related to :ref:`audi
8080
* Event names (for example, ``password_change``). For details, see :ref:`Audit log events <audit-log-events>`.
8181
* Event groups (for example, ``audit``). For details, see :ref:`Event groups <audit-log-event-groups>`.
8282

83-
The option contains either one value from above or a combination of them.
83+
The option contains either one value from ``Possible values`` section (see below) or a combination of them.
8484

85-
To enable :ref:`user-defined audit log events <audit-log-custom>`, specify the ``custom`` value in this option.
85+
To enable :ref:`custom audit log events <audit-log-custom>`, specify the ``custom`` value in this option.
86+
87+
**Example**
88+
89+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/audit_log/myapp.lua
90+
:language: lua
91+
:start-at: filter:
92+
:end-at: custom ]
93+
:dedent:
8694

8795
|
8896
| Type: array
@@ -154,7 +162,7 @@ The ``audit_log`` section defines configuration parameters related to :ref:`audi
154162

155163
Specify a pipe for the audit log destination.
156164
You can set the ``pipe`` type using the :ref:`audit_log.to <configuration_reference_audit_to>` option.
157-
If log is a program, its pid is stored in the ``audit_log.logger_pid`` variable.
165+
If log is a program, its pid is stored in the ``audit.pid`` field.
158166
You need to send it a signal to rotate logs.
159167

160168
**Example**
@@ -218,7 +226,7 @@ The ``audit_log`` section defines configuration parameters related to :ref:`audi
218226

219227
.. confval:: audit_log.syslog_identity
220228

221-
Specify an arbitrary string that will be placed at the beginning of all messages.
229+
Specify an application name to show in logs.
222230
You can enable logging to a system logger using the :ref:`audit_log.to <configuration_reference_audit_to>` option.
223231

224232
See also: :ref:`syslog configuration example <configuration_reference_audit_syslog-example>`.
@@ -251,47 +259,17 @@ The ``audit_log`` section defines configuration parameters related to :ref:`audi
251259
- :ref:`audit_log.syslog_facility <configuration_reference_audit_syslog-facility>` -- a system logger keyword that tells syslogd where to send the message.
252260
The default value is ``local7``.
253261

254-
- :ref:`audit_log.syslog_identity <configuration_reference_audit_syslog-identity>` -- a string placed at the beginning of every message.
262+
- :ref:`audit_log.syslog_identity <configuration_reference_audit_syslog-identity>` -- an application name to show in logs.
255263
The default value is ``tarantool``.
256264

257265
These options are interpreted as a message for the `syslogd <https://datatracker.ietf.org/doc/html/rfc5424>`_ program,
258266
which runs in the background of any Unix-like platform.
259267

260268
An example of a Tarantool audit log entry in the syslog:
261269

262-
.. code-block:: json
263-
264-
{
265-
"__CURSOR" : "s=81564632436a4de590e80b89b0151148;i=11519;b=def80c1464fe49d1aac8a64895d6614d;m=8c825ebfc;t=5edb27a75f282;x=7eba320f7cc9ae4d",
266-
"__REALTIME_TIMESTAMP" : "1668725698065026",
267-
"__MONOTONIC_TIMESTAMP" : "37717666812",
268-
"_BOOT_ID" : "def80c1464fe49d1aac8a64895d6614d",
269-
"_UID" : "1003",
270-
"_GID" : "1004",
271-
"_COMM" : "tarantool",
272-
"_EXE" : "/app/tarantool/dist/tdg-2.6.4.0.x86_64/tarantool",
273-
"_CMDLINE" : "tarantool init.lua <running>: core-03",
274-
"_CAP_EFFECTIVE" : "0",
275-
"_AUDIT_SESSION" : "1",
276-
"_AUDIT_LOGINUID" : "1003",
277-
"_SYSTEMD_CGROUP" : "/user.slice/user-1003.slice/[email protected]/app.slice/[email protected]",
278-
"_SYSTEMD_OWNER_UID" : "1003",
279-
"_SYSTEMD_UNIT" : "[email protected]",
280-
"_SYSTEMD_USER_UNIT" : "[email protected]",
281-
"_SYSTEMD_SLICE" : "user-1003.slice",
282-
"_SYSTEMD_USER_SLICE" : "app.slice",
283-
"_SYSTEMD_INVOCATION_ID" : "be368b4243d842ea8c06b010e0df62c2",
284-
"_MACHINE_ID" : "2e2339725deb4bc198c54ff4a2e8d626",
285-
"_HOSTNAME" : "vm-0.test.env",
286-
"_TRANSPORT" : "syslog",
287-
"PRIORITY" : "6",
288-
"SYSLOG_FACILITY" : "23",
289-
"SYSLOG_IDENTIFIER" : "tarantool",
290-
"SYSLOG_PID" : "101562",
291-
"_PID" : "101562",
292-
"MESSAGE" : "remote: session_type:background module:common.admin.auth user: type:custom_tdg_audit tag:tdg_severity_INFO description:[119eae0e-a691-42cc-9b4c-f14c499e6726] subj: \"anonymous\", msg: \"Access granted to anonymous user\"",
293-
"_SOURCE_REALTIME_TIMESTAMP" : "1668725698064202"
294-
}
270+
.. code-block:: text
271+
272+
09:32:52 tarantool: {"time": "2024-02-08T09:32:52.190+0300", "uuid": "94454e46-9a0e-493a-bb9f-d59e44a43581", "severity": "INFO", "remote": "unix/:(socket)", "session_type": "console", "module": "tarantool", "user": "admin", "type": "space_create", "tag": "", "description": "Create space bands"}
295273
296274
.. warning::
297275

@@ -314,7 +292,7 @@ The ``audit_log`` section defines configuration parameters related to :ref:`audi
314292

315293
- ``devnull``: disable audit logging.
316294
- ``file``: write audit logs to a file (see :ref:`audit_log.file <configuration_reference_audit_file>`).
317-
- ``pipe``: write audit logs to a pipe (see :ref:`audit_log.pipe <configuration_reference_audit_pipe>`).
295+
- ``pipe``: start a program and write audit logs to it (see :ref:`audit_log.pipe <configuration_reference_audit_pipe>`).
318296
- ``syslog``: write audit logs to a system logger (see :ref:`audit_log.syslog <configuration_reference_audit_pipe>`).
319297

320298
By default, audit logging is disabled.

0 commit comments

Comments
 (0)