3
3
Logs
4
4
====
5
5
6
- Each Tarantool instance logs important events to its own log file `` <instance-name>.log `` .
6
+ Each Tarantool instance logs important events to its own log file.
7
7
For instances started with :ref: `tt <tt-cli >`, the log location is defined by
8
8
the ``log_dir `` parameter in the :ref: `tt configuration <tt-config >`.
9
9
By default, it's ``/var/log/tarantool `` in the ``tt `` :ref: `system mode <tt-config_modes >`,
@@ -14,34 +14,36 @@ To check how logging works, write something to the log using the :ref:`log <log-
14
14
15
15
.. code-block :: console
16
16
17
- $ tt connect my_app
17
+ $ tt connect application
18
18
• Connecting to the instance...
19
- • Connected to /var/run/tarantool/my_app.control
19
+ • Connected to application
20
20
21
- /var/run/tarantool/my_app.control> require('log').info("Hello for the manual readers")
21
+ application> require('log').info("Hello for the manual readers")
22
+ ---
23
+ ...
22
24
23
25
Then check the logs:
24
26
25
27
.. code-block :: console
26
28
27
- $ tail / var/log/tarantool/my_app .log
28
- 2023-09-12 18:13:00.396 [67173 ] main/111/guard of feedback_daemon/box.feedback_daemon V> metrics_collector restarted
29
- 2023-09-12 18:13:00.396 [67173 ] main/103/- /box.feedback_daemon V> feedback_daemon started
30
- 2023-09-12 18:13:00.396 [67173 ] main/103/- D> memtx_tuple_new_raw_impl(14) = 0x1090077b4
31
- 2023-09-12 18:13:00.396 [67173 ] main/103/- D> memtx_tuple_new_raw_impl(26) = 0x1090077ec
32
- 2023-09-12 18:13:00.396 [67173 ] main/103/- D> memtx_tuple_new_raw_impl(39) = 0x109007824
33
- 2023-09-12 18:13:00.396 [67173 ] main/103/- D> memtx_tuple_new_raw_impl(24) = 0x10900785c
34
- 2023-09-12 18:13:00.396 [67173 ] main/103/- D> memtx_tuple_new_raw_impl(39) = 0x109007894
35
- 2023-09-12 18:13:00.396 [67173 ] main/106/checkpoint_daemon I> scheduled next checkpoint for Tue Sep 12 19:44:34 2023
36
- 2023-09-12 18:13:00.396 [67173 ] main I> entering the event loop
37
- 2023-09-12 18:13:11.656 [67173 ] main/114 /console/unix/:/tarantool I> Hello for the manual readers
29
+ $ tail instances.enabled/application/ var/log/instance001/tt .log
30
+ 2024-04-09 17:34:29.489 [49502 ] main/106/gc I> wal/engine cleanup is resumed
31
+ 2024-04-09 17:34:29.489 [49502 ] main/104/interactive /box.load_cfg I> set 'instance_name' configuration option to "instance001"
32
+ 2024-04-09 17:34:29.489 [49502 ] main/104/interactive/box.load_cfg I> set 'custom_proc_title' configuration option to "tarantool - instance001"
33
+ 2024-04-09 17:34:29.489 [49502 ] main/104/interactive/box.load_cfg I> set 'log_nonblock' configuration option to false
34
+ 2024-04-09 17:34:29.489 [49502 ] main/104/interactive/box.load_cfg I> set 'replicaset_name' configuration option to "replicaset001"
35
+ 2024-04-09 17:34:29.489 [49502 ] main/104/interactive/box.load_cfg I> set 'listen' configuration option to [{"uri":"127.0.0.1:3301"}]
36
+ 2024-04-09 17:34:29.489 [49502 ] main/107/checkpoint_daemon I> scheduled next checkpoint for Tue Apr 9 19:08:04 2024
37
+ 2024-04-09 17:34:29.489 [49502 ] main/104/interactive/box.load_cfg I> set 'metrics' configuration option to {"labels":{"alias":"instance001"},"include":["all"],"exclude":[]}
38
+ 2024-04-09 17:34:29.489 [49502 ] main I> entering the event loop
39
+ 2024-04-09 17:34:38.905 [49502 ] main/116 /console/unix/:/tarantool I> Hello for the manual readers
38
40
39
41
.. _admin-logs-rotation :
40
42
41
43
Log rotation
42
44
------------
43
45
44
- When :ref: `logging to a file <cfg_logging-log >`, the system administrator must ensure
46
+ When :ref: `logging to a file <configuration_reference_log_file >`, the system administrator must ensure
45
47
logs are rotated timely and do not take up all the available disk space.
46
48
The recommended way to prevent log files from growing infinitely is using an external
47
49
log rotation program, for example, ``logrotate ``, which is pre-installed on most
@@ -76,22 +78,16 @@ To learn about log rotation in the deprecated ``tarantoolctl`` utility,
76
78
check its :ref: `documentation <tarantoolctl-log-rotation >`.
77
79
78
80
79
- .. _admin-logs-formats :
81
+ .. _admin-logs-destination :
80
82
81
- Log formats
82
- -----------
83
+ Log destination
84
+ ---------------
83
85
84
- Tarantool can write its logs to a log file, to ``syslog ``, or to a specified program
85
- through a pipe.
86
+ Tarantool can write its logs to a log file, to ``syslog ``, or to a specified program through a pipe.
87
+ For example, to send logs to `` syslog ``, specify the :ref: ` log.to < configuration_reference_log_to >` parameter as follows:
86
88
87
- File is the default log format for ``tt ``. To send logs to a pipe or ``syslog ``,
88
- specify the :ref: `box.cfg.log <cfg_logging-log >` parameter, for example:
89
-
90
- .. code-block :: lua
91
-
92
- box.cfg{log = '| cronolog tarantool.log'}
93
- -- or
94
- box.cfg{log = 'syslog:identity=tarantool,facility=user'}
95
-
96
- In such configurations, log rotation is usually handled by the external program
97
- used for logging.
89
+ .. literalinclude :: /code_snippets/snippets/config/instances.enabled/log_syslog/config.yaml
90
+ :language: yaml
91
+ :start-at: log:
92
+ :end-at: 127.0.0.1:514
93
+ :dedent:
0 commit comments