Merge in SNORT/snort3 from ~OSHUMEIK/snort3:cfg_dump_pid to master
Squashed commit of the following:
commit
818389e207fe57ac24e3095dbc42f4cf9eeeff35
Author: Oleksii Shumeiko <oshumeik@cisco.com>
Date: Mon Mar 24 15:45:24 2025 +0200
dump_config: include PID into dump file name
--dump-config-text, --dump-config=all, --dump-config=top.
They are described in detail below.
-The --gen-dump-config <file> option enables Snort to generate a dump
-configuration file with a timestamp and config generation ID
-during startup and reload.
+The --gen-dump-config <file> option enables Snort to dump configuration to
+a file with PID, timestamp, and config generation ID during startup and reload.
The simple configuration is used in examples.
The output contains applied configurations (defaults and configured).
#include <mutex>
#include <pwd.h>
#include <syslog.h>
+#include <sys/types.h>
+#include <unistd.h>
#include <unordered_map>
#include "actions/ips_actions.h"
{
++threads_cnt;
+ file_name += "_";
+ file_name += std::to_string(getpid());
file_name += "_";
file_name += std::to_string(timestamp);
file_name += "_";
"enable features used in testing" },
{ "--gen-dump-config", Parameter::PT_STRING, nullptr, nullptr,
- "<file> dump configuration to <file_timestamp> during startup and configuration reload" },
+ "<file> dump configuration to a file during startup and configuration reload" },
{ "--gen-msg-map", Parameter::PT_IMPLIED, nullptr, nullptr,
"dump configured rules in gen-msg.map format for use by other tools" },