From 89936d65a231acb9d92c87857bf3b02450c451a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20El=20Siba=C3=AFe?= Date: Fri, 21 Apr 2023 16:51:56 +0200 Subject: [PATCH 1/4] Client_make_run: set default logs directory - base_dir/logs/default_daily_logs_path --- src/lib_client_base_unix/client_main_run.ml | 30 ++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/lib_client_base_unix/client_main_run.ml b/src/lib_client_base_unix/client_main_run.ml index 159883bba683..90c1a77c9408 100644 --- a/src/lib_client_base_unix/client_main_run.ml +++ b/src/lib_client_base_unix/client_main_run.ml @@ -430,17 +430,9 @@ let main (module C : M) ~select_commands = in let*! r = let* parsed, remaining = C.parse_config_args full original_args in - let parsed_config_file = parsed.Client_config.parsed_config_file - and parsed_args = parsed.Client_config.parsed_args - and config_commands = parsed.Client_config.config_commands in - let*! () = - Tezos_base_unix.Internal_event_unix.init_with_defaults - ?enable_default_daily_logs_at:C.default_daily_logs_path - ?internal_events: - (Option.bind parsed_config_file (fun cf -> - cf.Client_config.Cfg_file.internal_events)) - () - in + let parsed_config_file = parsed.Client_config.parsed_config_file in + let parsed_args = parsed.Client_config.parsed_args in + let config_commands = parsed.Client_config.config_commands in let base_dir : string = match parsed.Client_config.base_dir with | Some p -> p @@ -448,7 +440,21 @@ let main (module C : M) ~select_commands = match parsed_config_file with | None -> C.default_base_dir | Some p -> p.Client_config.Cfg_file.base_dir) - and require_auth = parsed.Client_config.require_auth in + in + let daily_logs_path = + C.default_daily_logs_path + |> Option.map + Filename.Infix.(fun logdir -> base_dir // "logs" // logdir) + in + let require_auth = parsed.Client_config.require_auth in + let*! () = + Tezos_base_unix.Internal_event_unix.init_with_defaults + ?enable_default_daily_logs_at:daily_logs_path + ?internal_events: + (Option.bind parsed_config_file (fun cf -> + cf.Client_config.Cfg_file.internal_events)) + () + in let rpc_config = let rpc_config : RPC_client_unix.config = match parsed_config_file with -- GitLab From 64e7a1fe6a906314a5ddab3c88e1a566659cea64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20El=20Siba=C3=AFe?= Date: Fri, 21 Apr 2023 16:53:02 +0200 Subject: [PATCH 2/4] Baker: enable daily-logs in the baker --- .../bin_baker/main_baker_016_PtMumbai.ml | 8 +++++++- .../bin_baker/main_baker_017_PtNairob.ml | 8 +++++++- src/proto_alpha/bin_baker/main_baker_alpha.ml | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/proto_016_PtMumbai/bin_baker/main_baker_016_PtMumbai.ml b/src/proto_016_PtMumbai/bin_baker/main_baker_016_PtMumbai.ml index cd13f466fd9b..bd7485151dc4 100644 --- a/src/proto_016_PtMumbai/bin_baker/main_baker_016_PtMumbai.ml +++ b/src/proto_016_PtMumbai/bin_baker/main_baker_016_PtMumbai.ml @@ -44,4 +44,10 @@ let select_commands _ _ = validation will not be more expensive. *) let () = Tezos_sapling.Core.Validator.init_params () -let () = Client_main_run.run (module Daemon_config) ~select_commands +module Config = struct + include Daemon_config + + let default_daily_logs_path = Some ("octez-baker-" ^ Protocol.name) +end + +let () = Client_main_run.run (module Config) ~select_commands diff --git a/src/proto_017_PtNairob/bin_baker/main_baker_017_PtNairob.ml b/src/proto_017_PtNairob/bin_baker/main_baker_017_PtNairob.ml index cd13f466fd9b..bd7485151dc4 100644 --- a/src/proto_017_PtNairob/bin_baker/main_baker_017_PtNairob.ml +++ b/src/proto_017_PtNairob/bin_baker/main_baker_017_PtNairob.ml @@ -44,4 +44,10 @@ let select_commands _ _ = validation will not be more expensive. *) let () = Tezos_sapling.Core.Validator.init_params () -let () = Client_main_run.run (module Daemon_config) ~select_commands +module Config = struct + include Daemon_config + + let default_daily_logs_path = Some ("octez-baker-" ^ Protocol.name) +end + +let () = Client_main_run.run (module Config) ~select_commands diff --git a/src/proto_alpha/bin_baker/main_baker_alpha.ml b/src/proto_alpha/bin_baker/main_baker_alpha.ml index cd13f466fd9b..bd7485151dc4 100644 --- a/src/proto_alpha/bin_baker/main_baker_alpha.ml +++ b/src/proto_alpha/bin_baker/main_baker_alpha.ml @@ -44,4 +44,10 @@ let select_commands _ _ = validation will not be more expensive. *) let () = Tezos_sapling.Core.Validator.init_params () -let () = Client_main_run.run (module Daemon_config) ~select_commands +module Config = struct + include Daemon_config + + let default_daily_logs_path = Some ("octez-baker-" ^ Protocol.name) +end + +let () = Client_main_run.run (module Config) ~select_commands -- GitLab From 052fbc9a7eed6d3d608e12636c9516d9b6481653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20El=20Siba=C3=AFe?= Date: Tue, 25 Apr 2023 10:00:49 +0200 Subject: [PATCH 3/4] Logging: update documentation with new baker configuration --- docs/user/logging.rst | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/user/logging.rst b/docs/user/logging.rst index 8401ef34c219..04cc448baa3f 100644 --- a/docs/user/logging.rst +++ b/docs/user/logging.rst @@ -57,7 +57,8 @@ This sink is the one currently activated by default: ``TEZOS_LOG`` environment variable or the specific section in the node’s configuration file (see below). -This sink can only output pretty-printed versions of the events. +This sink can only output pretty-printed versions of the events, by default +on standard output (stdout). File-Descriptor Sinks ~~~~~~~~~~~~~~~~~~~~~ @@ -213,11 +214,12 @@ By default, the Octez binaries generate **user logs** as follows: - ``lwt-log://`` sinks are activated by default and configured to output events of level at least ``Notice``. Their goal is the stdout logging. -The node additionally generates by default more detailed **internal logs** as follows: - -- A file-descriptor-sink is activated to store logs from last seven days with - an ``Info`` level. The path is ``/daily-logs/``. +The node and the baker additionally generate by default more detailed +**internal logs** as follows: +- A file-descriptor-sink is activated to store logs from last seven days with an + ``Info`` level. For the node, the path is ``/daily-logs/``. For + other tools, see the corresponding sections in this page. JSON Configuration Format ------------------------- @@ -326,13 +328,19 @@ events) this call adds a sink to suddenly start pretty-printing all Client and baker configuration ------------------------------ -For now, ``octez-client``, ``octez-{baker,accuser}-*``, etc. -can only be configured using the environment variables. +Both ``octez-client`` and ``octez-{baker,accuser}-*`` can be configured either +using environment variables or using ``internal-events`` in the client configuration +file, with the file-descriptor sinks described above. -There is one common option ``--log-requests`` which can be used to trace +There is also one common option ``--log-requests`` which can be used to trace all the interactions with the node (but it does *not* use the logging framework). +By default, the baker also generates internal logs, which are stored at +``/logs/baker-/*``. Hence, running two bakers +(for two different accounts) using the same protocol with the same base +directory is not recommended. + Processing Structured Events ---------------------------- -- GitLab From fa14ff39852de9eaadadbf1148c058222815e9a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20El=20Siba=C3=AFe?= Date: Tue, 9 May 2023 16:41:43 +0200 Subject: [PATCH 4/4] update changelog for baker daily logs --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 9e6b3fc07b47..d1516a247c22 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -116,6 +116,9 @@ Baker memory consumption. However, this mode is less performant and may result in noticable slower baking times. (MR :gl:`!8607`) +- Added a default configuration for that enables disk logs as a + file-descriptor-sink in the base directory with a 7 days rotation. + Accuser ------- -- GitLab