![]() |
Kea 3.1.1
|
#include <legal_syslog.h>
Public Member Functions | |
LegalSyslog (const isc::db::DatabaseConnection::ParameterMap ¶meters) | |
Constructor. | |
virtual | ~LegalSyslog ()=default |
Destructor. | |
virtual void | close () |
Closes the store. | |
virtual std::string | getType () const |
Return backend type. | |
virtual void | open () |
Opens the store. | |
virtual void | writeln (const std::string &text, const std::string &addr) |
Appends a string to the store with a timestamp and address. | |
![]() | |
LegalLogMgr (const isc::db::DatabaseConnection::ParameterMap parameters) | |
Constructor. | |
virtual | ~LegalLogMgr ()=default |
Destructor. | |
virtual struct tm | currentTimeInfo () const |
Returns the current local date and time. | |
virtual std::string | getNowString () const |
Returns the current date and time as string. | |
virtual std::string | getNowString (const std::string &format) const |
Returns the current date and time as a string using a specific strftime format string. | |
virtual isc::db::DatabaseConnection::ParameterMap | getParameters () const |
Return backend parameters. | |
isc::dhcp::ExpressionPtr | getRequestFormatExpression () |
Gets request extended format expression for custom logging. | |
isc::dhcp::ExpressionPtr | getResponseFormatExpression () |
Gets response extended format expression for custom logging. | |
std::string | getTimestampFormat () |
Gets the timestamp format used for logging. | |
virtual bool | isUnusable () |
Flag which indicates if the forensic log backend has at least one unusable connection. | |
virtual struct timespec | now () const |
Returns the current system time. | |
virtual void | setParameters (isc::db::DatabaseConnection::ParameterMap parameters) |
Sets backend parameters. | |
void | setRequestFormatExpression (const std::string &extended_format) |
Sets request extended format expression for custom logging. | |
void | setResponseFormatExpression (const std::string &extended_format) |
Sets response extended format expression for custom logging. | |
void | setTimestampFormat (const std::string ×tamp_format) |
Sets the timestamp format used for logging. | |
Static Public Member Functions | |
static isc::dhcp::LegalLogMgrPtr | factory (const isc::db::DatabaseConnection::ParameterMap ¶meters) |
Factory class method. | |
![]() | |
static std::string | genDurationString (const uint32_t secs) |
Translates seconds into a text string of days, hours, minutes and seconds. | |
static std::string | getLogPath (bool reset=false, const std::string explicit_path="") |
Fetches the supported legal log file path. | |
static std::string | getTimeString (const struct timespec &time, const std::string &format) |
Returns a time as string. | |
static void | parseConfig (const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map) |
Parse database specification. | |
static void | parseDatabase (const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map) |
Parse database specification. | |
static void | parseExtraParameters (const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map) |
Parse extra parameters which are not related to backend connection. | |
static void | parseFile (const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map) |
Parse file specification. | |
static void | parseSyslog (const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map) |
Parse syslog specification. | |
static std::string | validatePath (const std::string logpath) |
Validates a log path against the supported path for legal log files. | |
static std::string | vectorDump (const std::vector< uint8_t > &bytes) |
Creates a string from a vector of printable bytes. | |
static std::string | vectorHexDump (const std::vector< uint8_t > &bytes, const std::string &delimiter=":") |
Creates a string of hex digit pairs from a vector of bytes. | |
Definition at line 15 of file legal_syslog.h.
isc::legal_log::LegalSyslog::LegalSyslog | ( | const isc::db::DatabaseConnection::ParameterMap & | parameters | ) |
Constructor.
parameters | A data structure relating keywords and values concerned with the manager configuration. |
The name of the logger may be no longer than MAX_LOGGER_NAME_SIZE else the program will throw an exception. This restriction allows loggers to be declared statically: the name is stored in a fixed-size array to avoid the need to allocate heap storage during program initialization (which causes problems on some operating systems). e.g. of error: '<logger-name>' is not a valid name for a logger: valid names must be between 1 and 31 characters in length.
Definition at line 27 of file legal_syslog.cc.
References isc::dhcp::LegalLogMgr::LegalLogMgr(), isc::dhcp::CfgMgr::getStagingCfg(), isc::db::info, isc::dhcp::CfgMgr::instance(), isc::process::LoggingDestination::output_, and isc::process::LoggingDestination::pattern_.
Referenced by factory().
|
virtualdefault |
Destructor.
The destructor does call the close method.
|
virtual |
|
static |
Factory class method.
parameters | A data structure relating keywords and values concerned with the database. |
Definition at line 76 of file legal_syslog.cc.
References LegalSyslog(), isc::legal_log::legal_log_logger, LEGAL_LOG_SYSLOG_STORE_OPEN, LOG_INFO, and isc::db::DatabaseConnection::redactedAccessString().
Referenced by load().
|
virtual |
Return backend type.
Returns the type of the backend (e.g. "mysql", "logfile" etc.)
Implements isc::dhcp::LegalLogMgr.
Definition at line 71 of file legal_syslog.cc.
|
virtual |
|
virtual |
Appends a string to the store with a timestamp and address.
text | String to append |
addr | Address or prefix |
LegalLogMgrError | if the write fails |
Implements isc::dhcp::LegalLogMgr.
Definition at line 65 of file legal_syslog.cc.
References LEGAL_LOG_SYSLOG, and LOG_INFO.