Kea: isc::legal_log::LegalSyslog Class Reference

| Kea 3.2.0-git

isc::legal_log::LegalSyslog Class Reference

`#include <legal_syslog.h>`

Inheritance diagram for isc::legal_log::LegalSyslog:
[legend]

## Public Member Functions
| LegalSyslog (const isc::db::DatabaseConnection::ParameterMap &parameters)
| 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.
Public Member Functions inherited from isc::dhcp::LegalLogMgr
| 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 &timestamp_format)
| Sets the timestamp format used for logging.

## Static Public Member Functions
static isc::dhcp::LegalLogMgrPtr | factory (const isc::db::DatabaseConnection::ParameterMap &parameters)
| Factory class method.
Static Public Member Functions inherited from isc::dhcp::LegalLogMgr
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 &parameters, isc::db::DatabaseConnection::ParameterMap &map)
| Parse database specification.
static void | parseDatabase (const isc::data::ConstElementPtr &parameters, isc::db::DatabaseConnection::ParameterMap &map)
| Parse database specification.
static void | parseExtraParameters (const isc::data::ConstElementPtr &parameters, isc::db::DatabaseConnection::ParameterMap &map)
| Parse extra parameters which are not related to backend connection.
static void | parseFile (const isc::data::ConstElementPtr &parameters, isc::db::DatabaseConnection::ParameterMap &map)
| Parse file specification.
static void | parseSyslog (const isc::data::ConstElementPtr &parameters, 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.

## Detailed Description

Definition at line 15 of file legal_syslog.h.

## Constructor & Destructor Documentation

## ◆ LegalSyslog()

isc::legal_log::LegalSyslog::LegalSyslog | ( | const isc::db::DatabaseConnection::ParameterMap & | parameters | ) |

Constructor.

Note
  The supported parameters are:
  - syslog parameters:
    - pattern
    - facility

Parameters

  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().

Here is the call graph for this function:

## ◆ ~LegalSyslog()

virtual isc::legal_log::LegalSyslog::~LegalSyslog | ( |  | ) |
| virtualdefault

Destructor.

The destructor does call the close method.

## Member Function Documentation

## ◆ close()

void isc::legal_log::LegalSyslog::close | ( |  | ) |
| virtual

Closes the store.

Implements isc::dhcp::LegalLogMgr.

Definition at line 61 of file legal_syslog.cc.

## ◆ factory()

LegalLogMgrPtr isc::legal_log::LegalSyslog::factory | ( | const isc::db::DatabaseConnection::ParameterMap & | parameters | ) |
| static

Factory class method.

Parameters

  parameters | A data structure relating keywords and values concerned with the database.

Returns
  The Syslog File Store Backend.

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().

Here is the call graph for this function:

## ◆ getType()

string isc::legal_log::LegalSyslog::getType | ( |  | ) | const
| virtual

Return backend type.

Returns the type of the backend (e.g. "mysql", "logfile" etc.)

Returns
  Type of the backend.

Implements isc::dhcp::LegalLogMgr.

Definition at line 71 of file legal_syslog.cc.

## ◆ open()

void isc::legal_log::LegalSyslog::open | ( |  | ) |
| virtual

Opens the store.

Implements isc::dhcp::LegalLogMgr.

Definition at line 57 of file legal_syslog.cc.

## ◆ writeln()

void isc::legal_log::LegalSyslog::writeln | ( | const std::string & | text,
|  | const std::string & | addr )
| virtual

Appends a string to the store with a timestamp and address.

Parameters

  text | String to append
  addr | Address or prefix

Exceptions

  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.

The documentation for this class was generated from the following files:

- legal_syslog.h
- legal_syslog.cc