extern const isc::log::MessageID LEGAL_LOG_STORE_CLOSE_ERROR = "LEGAL_LOG_STORE_CLOSE_ERROR";
extern const isc::log::MessageID LEGAL_LOG_STORE_OPEN = "LEGAL_LOG_STORE_OPEN";
extern const isc::log::MessageID LEGAL_LOG_STORE_OPENED = "LEGAL_LOG_STORE_OPENED";
+extern const isc::log::MessageID LEGAL_LOG_SYSLOG = "LEGAL_LOG_SYSLOG";
+extern const isc::log::MessageID LEGAL_LOG_SYSLOG_STORE_OPEN = "LEGAL_LOG_SYSLOG_STORE_OPEN";
extern const isc::log::MessageID LEGAL_LOG_UNLOAD_ERROR = "LEGAL_LOG_UNLOAD_ERROR";
-extern const isc::log::MessageID LEGAL_SYSLOG_LOG = "LEGAL_SYSLOG_LOG";
-extern const isc::log::MessageID LEGAL_SYSLOG_STORE_OPEN = "LEGAL_SYSLOG_STORE_OPEN";
namespace {
"LEGAL_LOG_STORE_CLOSE_ERROR", "An error occurred closing the store: %1, error: %2",
"LEGAL_LOG_STORE_OPEN", "opening Legal Log file: %1",
"LEGAL_LOG_STORE_OPENED", "Legal store opened: %1",
+ "LEGAL_LOG_SYSLOG", "%1",
+ "LEGAL_LOG_SYSLOG_STORE_OPEN", "opening Legal Syslog: %1",
"LEGAL_LOG_UNLOAD_ERROR", "An error occurred unloading the library: %1",
- "LEGAL_SYSLOG_LOG", "%1",
- "LEGAL_SYSLOG_STORE_OPEN", "opening Legal Syslog: %1",
NULL
};
extern const isc::log::MessageID LEGAL_LOG_STORE_CLOSE_ERROR;
extern const isc::log::MessageID LEGAL_LOG_STORE_OPEN;
extern const isc::log::MessageID LEGAL_LOG_STORE_OPENED;
+extern const isc::log::MessageID LEGAL_LOG_SYSLOG;
+extern const isc::log::MessageID LEGAL_LOG_SYSLOG_STORE_OPEN;
extern const isc::log::MessageID LEGAL_LOG_UNLOAD_ERROR;
-extern const isc::log::MessageID LEGAL_SYSLOG_LOG;
-extern const isc::log::MessageID LEGAL_SYSLOG_STORE_OPEN;
#endif // LEGAL_LOG_MESSAGES_H
V6) is about to open a legal log file. The parameters of
the backend are logged.
-% LEGAL_SYSLOG_STORE_OPEN opening Legal Syslog: %1
+% LEGAL_LOG_SYSLOG_STORE_OPEN opening Legal Syslog: %1
This informational message is logged when a DHCP server (either V4 or
V6) is about to open a legal syslog store. The parameters of
the backend are logged.
-% LEGAL_SYSLOG_LOG %1
+% LEGAL_LOG_SYSLOG %1
This informational message contains the message being logged to syslog.
% LEGAL_LOG_STORE_OPENED Legal store opened: %1
-// Copyright (C) 2016-2025 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2025 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
LoggingInfo info;
// Remove default destinations as we are going to replace them.
info.clearDestinations();
- info.name_ = "legal-log-syslog-";
+ info.name_ = "legal-log-";
info.name_ += boost::lexical_cast<std::string>(reinterpret_cast<uint64_t>(this));
logger_.reset(new Logger(info.name_.c_str()));
LoggingDestination dest;
void
LegalSyslog::writeln(const string& text, const string&) {
- LOG_INFO(*logger_, LEGAL_SYSLOG_LOG)
+ LOG_INFO(*logger_, LEGAL_LOG_SYSLOG)
.arg(text);
}
LegalLogMgrPtr
LegalSyslog::factory(const DatabaseConnection::ParameterMap& parameters) {
- LOG_INFO(legal_log_logger, LEGAL_SYSLOG_STORE_OPEN)
+ LOG_INFO(legal_log_logger, LEGAL_LOG_SYSLOG_STORE_OPEN)
.arg(DatabaseConnection::redactedAccessString(parameters));
return (LegalLogMgrPtr(new LegalSyslog(parameters)));
}
/// @param parameters A data structure relating keywords and values
/// concerned with the database.
///
- /// @return The Rotating File Store Backend.
+ /// @return The Syslog File Store Backend.
static isc::dhcp::LegalLogMgrPtr
factory(const isc::db::DatabaseConnection::ParameterMap& parameters);
};
"The type of the forensic log backend: 'awesomesql' is not supported");
}
+TEST_F(LegalLogMgrTest, syslogNoParameters) {
+ db::DatabaseConnection::ParameterMap map;
+ EXPECT_THROW(LegalLogMgr::parseSyslog(ConstElementPtr(), map), BadValue);
+}
+
} // end of anonymous namespace
// uint32_t
for (char const* const& key : {
- "connect-timeout", "reconnect-wait-time", "max-reconnect-tries"}) {
+ "connect-timeout", "reconnect-wait-time", "max-reconnect-tries",
+ "read-timeout", "write-timeout", "tcp-user-timeout"}) {
ConstElementPtr const value(parameters->get(key));
if (value) {
int64_t integer_value(value->intValue());
/// Parse the configuration and check that the various keywords are
/// consistent.
///
+ /// @note The supported parameters are:
+ /// - common parameters:
+ /// - type - one of: logfile (default), syslog, mysql, postgresql
+ /// - request-parser-format
+ /// - response-parser-format
+ /// - timestamp-format
+ /// - logfile parameters:
+ /// - path
+ /// - base-name
+ /// - time-unit - one of: second, day, month, year
+ /// - prerotate
+ /// - postrotate
+ /// - count
+ /// - syslog parameters:
+ /// - pattern
+ /// - facility
+ /// - database parameters:
+ /// - name
+ /// - host
+ /// - password
+ /// - port
+ /// - user
+ /// - trust-anchor (MySQL only)
+ /// - cert-file (MySQL only)
+ /// - key-file (MySQL only)
+ /// - cipher-list (MySQL only)
+ /// - reconnect-wait-time
+ /// - max-reconnect-tries
+ /// - on-fail
+ /// - retry-on-startup
+ /// - connect-timeout
+ /// - read-timeout (MySQL only)
+ /// - write-timeout (MySQL only)
+ /// - tcp-user-timeout (PostgreSQL only)
+ ///
/// @param parameters The library parameters.
/// @param map The parameter map used by LegalLogMgr objects.
static void parseConfig(const isc::data::ConstElementPtr& parameters, isc::db::DatabaseConnection::ParameterMap& map);
/// Parse the configuration and check that the various keywords are
/// consistent.
///
+ /// @note The supported parameters are:
+ /// - database parameters:
+ /// - name
+ /// - host
+ /// - password
+ /// - port
+ /// - user
+ /// - trust-anchor (MySQL only)
+ /// - cert-file (MySQL only)
+ /// - key-file (MySQL only)
+ /// - cipher-list (MySQL only)
+ /// - reconnect-wait-time
+ /// - max-reconnect-tries
+ /// - on-fail
+ /// - retry-on-startup
+ /// - connect-timeout
+ /// - read-timeout (MySQL only)
+ /// - write-timeout (MySQL only)
+ /// - tcp-user-timeout (PostgreSQL only)
+ ///
/// @param parameters The library parameters.
/// @param map The parameter map used by LegalLogMgr objects.
static void parseDatabase(const isc::data::ConstElementPtr& parameters, isc::db::DatabaseConnection::ParameterMap& map);
/// Parse the configuration and check that the various keywords are
/// consistent.
///
+ /// @note The supported parameters are:
+ /// - logfile parameters:
+ /// - path
+ /// - base-name
+ /// - time-unit - one of: second, day, month, year
+ /// - prerotate
+ /// - postrotate
+ /// - count
+ ///
/// @param parameters The library parameters.
/// @param [out] map The parameter map.
static void parseFile(const isc::data::ConstElementPtr& parameters, isc::db::DatabaseConnection::ParameterMap& map);
/// Parse the configuration and check that the various keywords are
/// consistent.
///
+ /// @note The supported parameters are:
+ /// - syslog parameters:
+ /// - pattern
+ /// - facility
+ ///
/// @param parameters The library parameters.
/// @param [out] map The parameter map.
static void parseSyslog(const isc::data::ConstElementPtr& parameters, isc::db::DatabaseConnection::ParameterMap& map);
/// @brief Parse extra parameters which are not related to backend
/// connection.
///
+ /// @note The supported parameters are:
+ /// - common parameters:
+ /// - request-parser-format
+ /// - response-parser-format
+ /// - timestamp-format
+ ///
/// @param parameters The library parameters.
/// @param [out] map The parameter map.
static void parseExtraParameters(const isc::data::ConstElementPtr& parameters, isc::db::DatabaseConnection::ParameterMap& map);