log: expose `-logratelimit` in normal help #35604

pull l0rinc wants to merge 1 commits into bitcoin:master from l0rinc:l0rinc/expose-logratelimit changing 1 files +1 −1
  1. l0rinc commented at 10:26 PM on June 25, 2026: contributor

    Follow-up to #32604 (comment)

    Problem: -logratelimit is currently registered as DEBUG_ONLY, so users who are not reading -help-debug are unlikely to discover the supported escape hatch when rate limiting interferes with diagnosis or log processing.

    Fix: Expose the existing option in normal help while keeping rate limiting enabled by default. Add argsman coverage to assert that -logratelimit is not DEBUG_ONLY and appears in the default help text.

    Reproducer: you can check manually by grepping the help page or by adding a temporary unit test - before and after the change and see the difference.

    <details><summary>bitcoind -help(-debug)</summary>

    cmake -B build && cmake --build build -j -t bitcoind
    build/bin/bitcoind -help-debug | grep -A2 logratelimit
    build/bin/bitcoind -help | grep -A2 logratelimit
    

    </details>

    <details><summary>util_LogRateLimitHelp</summary>

    diff --git a/src/test/argsman_tests.cpp b/src/test/argsman_tests.cpp
    index da0d684050..0e918afd6b 100644
    --- a/src/test/argsman_tests.cpp
    +++ b/src/test/argsman_tests.cpp
    @@ -3,6 +3,7 @@
     // file COPYING or http://www.opensource.org/licenses/mit-license.php.
     
     #include <common/args.h>
    +#include <init/common.h>
     #include <sync.h>
     #include <test/util/logging.h>
     #include <test/util/setup_common.h>
    @@ -710,6 +711,14 @@ BOOST_AUTO_TEST_CASE(util_AddCommand_clearargs_replaces_command_options)
         BOOST_CHECK(details.empty());
     }
     
    +BOOST_AUTO_TEST_CASE(util_LogRateLimitHelp)
    +{
    +    ArgsManager args;
    +    init::AddLoggingArgs(args);
    +    BOOST_CHECK_EQUAL(*Assert(args.GetArgFlags("-logratelimit")) & ArgsManager::DEBUG_ONLY, 0U);
    +    BOOST_CHECK(args.GetHelpMessage().find("-logratelimit") != std::string::npos);
    +}
    +
     BOOST_AUTO_TEST_CASE(util_GetChainTypeString)
     {
         TestArgsManager test_args;
    

    </details>

  2. DrahtBot added the label Utils/log/libs on Jun 25, 2026
  3. DrahtBot commented at 10:27 PM on June 25, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35604.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK stickies-v, Crypt-iQ, janb84
    Concept ACK sipa

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #31260 (scripted-diff: Type-safe settings retrieval by ryanofsky)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. in src/test/argsman_tests.cpp:720 in 4ba1ac73ba
     715 | +{
     716 | +    ArgsManager args;
     717 | +    init::AddLoggingArgs(args);
     718 | +    BOOST_CHECK_EQUAL(*Assert(args.GetArgFlags("-logratelimit")) & ArgsManager::DEBUG_ONLY, 0U);
     719 | +    BOOST_CHECK(args.GetHelpMessage().find("-logratelimit") != std::string::npos);
     720 | +}
    


    maflcko commented at 8:40 AM on June 26, 2026:

    Not sure about this test. Are we going to add such a 5-line test for each option?

    I'd say, either we have a full manpage linter (autogenerate the manpage and fail on a diff), or rely on manual tests.


    l0rinc commented at 1:45 PM on June 26, 2026:

    Would it be more welcome as a diff in the pr description? Was wondering the same myself...


    l0rinc commented at 5:03 PM on June 26, 2026:

    Thanks, I have remove the automated test and added it to the PR description - with manual steps to reproduce

  5. stickies-v commented at 11:44 AM on June 26, 2026: contributor

    I'm not sure. Are there any production use cases where this flag would be useful? To me this really seems like a debug flag, which makes the DEBUG_ONLY and DEBUG_TEST flags the most appropriate choice.

  6. l0rinc commented at 1:47 PM on June 26, 2026: contributor

    Are there any production use cases where this flag would be useful

    Just that it was needed by @gmaxwell (see #32604 (comment)) and comments indicated we should consider opening it up (cc: @Crypt-iQ, @darosior)

  7. stickies-v commented at 2:26 PM on June 26, 2026: contributor

    Concept NACK until there is better rationale. The option currently seems appropriately registered to me.

  8. Crypt-iQ commented at 2:31 PM on June 26, 2026: contributor

    The question I'm asking myself (that @darosior brought up) is whether allowing this flag in production builds and having a user set it is materially different from them setting -debug to something spammy? I don't think it is that different, though I still hesitate about this change...

  9. l0rinc renamed this:
    log: expose `-logratelimit` in normal help
    RFC log: expose `-logratelimit` in normal help
    on Jun 26, 2026
  10. l0rinc marked this as a draft on Jun 26, 2026
  11. darosior commented at 2:39 PM on June 26, 2026: member

    Outside of this, what option is there for a user who wants to run Bitcoin Core while keeping the previous behaviour that non-debug logs are never suppressed? For instance because they are aware of log-filling vectors but want to monitor the warning and info log levels of their node?

  12. stickies-v commented at 4:18 PM on June 26, 2026: contributor

    because they are aware of log-filling vectors but want to monitor the warning and info log levels of their node?

    Fair enough, this kind of monitoring can be useful in a production setting. Concept ACK. Thanks for changing my mind.

  13. l0rinc renamed this:
    RFC log: expose `-logratelimit` in normal help
    log: expose `-logratelimit` in normal help
    on Jun 26, 2026
  14. l0rinc marked this as ready for review on Jun 26, 2026
  15. log: expose -logratelimit option
    The existing `-logratelimit` option can disable log rate limiting, but it is hidden from ordinary help because it is registered as `DEBUG_ONLY`.
    Expose it in normal help so users affected by log suppression can discover the supported runtime knob.
    095596ddf7
  16. l0rinc force-pushed on Jun 26, 2026
  17. in src/init/common.cpp:41 in 095596ddf7
      37 | @@ -38,7 +38,7 @@ void AddLoggingArgs(ArgsManager& argsman)
      38 |      argsman.AddArg("-logsourcelocations", strprintf("Prepend debug output with name of the originating source location (source file, line number and function name) (default: %u)", DEFAULT_LOGSOURCELOCATIONS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
      39 |      argsman.AddArg("-logtimemicros", strprintf("Add microsecond precision to debug timestamps (default: %u)", DEFAULT_LOGTIMEMICROS), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
      40 |      argsman.AddArg("-loglevelalways", strprintf("Always prepend a category and level (default: %u)", DEFAULT_LOGLEVELALWAYS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
      41 | -    argsman.AddArg("-logratelimit", strprintf("Apply rate limiting to unconditional logging to mitigate disk-filling attacks (default: %u)", BCLog::DEFAULT_LOGRATELIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
      42 | +    argsman.AddArg("-logratelimit", strprintf("Apply rate limiting to unconditional logging to mitigate disk-filling attacks (default: %u)", BCLog::DEFAULT_LOGRATELIMIT), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
    


    Crypt-iQ commented at 7:43 PM on June 26, 2026:

    Should the OptionsCategory change from DEBUG_TEST?


    l0rinc commented at 5:58 AM on June 28, 2026:

    I think that's fine, it matches the surrounding normal-help logging args like -logips, -logtimestamps, -printtoconsole, and -shrinkdebugfile.

  18. sipa commented at 12:11 PM on June 27, 2026: member

    Concept ACK.

    The log limiting only applies to messages that are logged by default. Those that require explicit opting in to are not subject to it. This means we are already accepting that users may be subject to excessive log output if they opt in to specific messages. So this means disabling log-limiting is equivalent to "opting in" to the default messages.

  19. stickies-v approved
  20. stickies-v commented at 9:55 AM on June 30, 2026: contributor

    ACK 095596ddf7392f341ecff2c65d75263d64e37486

  21. DrahtBot requested review from sipa on Jun 30, 2026
  22. Crypt-iQ commented at 7:50 PM on June 30, 2026: contributor

    crACK 095596ddf7392f341ecff2c65d75263d64e37486

  23. janb84 commented at 8:03 AM on July 1, 2026: contributor

    ACK 095596ddf7392f341ecff2c65d75263d64e37486

    Seems reasonable to expose this option to the normal help text, since rate limiting applies to Info/Warning/Error messages. Think it's good that users who are troubleshooting via debug.log should know there's a way to disable ratelimiting.

    Code: OptionsCategory::DEBUG_TEST also seems reasonable to keep given existing precedent of the -loglevelalways, -logsourcelocations args.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-07-01 09:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me