17#include <boost/shared_ptr.hpp>
46 timestamp_format_(
"%Y-%m-%d %H:%M:%S %Z"),
47 parameters_(parameters) {
67 static std::string
getLogPath(
bool reset =
false,
68 const std::string explicit_path =
"");
76 static std::string
validatePath(
const std::string logpath);
211 virtual void writeln(
const std::string& text,
const std::string& addr) = 0;
228 virtual struct timespec
now() const;
253 virtual std::string
getNowString(
const std::string& format)
const;
267 static std::string
getTimeString(
const struct timespec& time,
const std::string& format);
292 static std::string
vectorHexDump(
const std::vector<uint8_t>& bytes,
293 const std::string& delimiter =
":");
300 static std::string
vectorDump(
const std::vector<uint8_t>& bytes);
311 return (request_expression_);
323 return (response_expression_);
340 return (timestamp_format_);
349 return (parameters_);
358 parameters_ = parameters;
379 std::string timestamp_format_;
389typedef std::map<ManagerID, std::pair<isc::db::DatabaseConnection::ParameterMap, LegalLogMgrPtr>>
LegalLogMgrPool;
This is a base class for exceptions thrown from the DNS library module.
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
LegalLogMgrError(const char *file, size_t line, const char *what)
isc::dhcp::ExpressionPtr getResponseFormatExpression()
Gets response extended format expression for custom logging.
virtual struct tm currentTimeInfo() const
Returns the current local date and time.
void setRequestFormatExpression(const std::string &extended_format)
Sets request extended format expression for custom logging.
virtual bool isUnusable()
Flag which indicates if the forensic log backend has at least one unusable connection.
static void parseSyslog(const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map)
Parse syslog specification.
static void parseFile(const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map)
Parse file specification.
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.
virtual void setParameters(isc::db::DatabaseConnection::ParameterMap parameters)
Sets backend parameters.
virtual std::string getType() const =0
Return backend type.
virtual ~LegalLogMgr()=default
Destructor.
std::string getTimestampFormat()
Gets the timestamp format used for logging.
static void parseDatabase(const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map)
Parse database specification.
void setResponseFormatExpression(const std::string &extended_format)
Sets response extended format expression for custom logging.
virtual void writeln(const std::string &text, const std::string &addr)=0
Appends a string to the store with a timestamp and address.
static std::string genDurationString(const uint32_t secs)
Translates seconds into a text string of days, hours, minutes and seconds.
static std::string validatePath(const std::string logpath)
Validates a log path against the supported path for legal log files.
virtual struct timespec now() const
Returns the current system time.
static std::string getTimeString(const struct timespec &time, const std::string &format)
Returns a time as string.
virtual void close()=0
Closes the store.
static std::string getLogPath(bool reset=false, const std::string explicit_path="")
Fetches the supported legal log file path.
virtual isc::db::DatabaseConnection::ParameterMap getParameters() const
Return backend parameters.
static std::string vectorDump(const std::vector< uint8_t > &bytes)
Creates a string from a vector of printable bytes.
LegalLogMgr(const isc::db::DatabaseConnection::ParameterMap parameters)
Constructor.
isc::dhcp::ExpressionPtr getRequestFormatExpression()
Gets request extended format expression for custom logging.
static void parseConfig(const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map)
Parse database specification.
void setTimestampFormat(const std::string ×tamp_format)
Sets the timestamp format used for logging.
static void parseExtraParameters(const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map)
Parse extra parameters which are not related to backend connection.
virtual void open()=0
Opens the store.
virtual std::string getNowString() const
Returns the current date and time as string.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< LegalLogMgr > LegalLogMgrPtr
Defines a smart pointer to a LegalLogMgr.
const string actionToVerb(Action action)
Translates an Action into its corresponding verb.
boost::shared_ptr< Expression > ExpressionPtr
std::map< ManagerID, std::pair< isc::db::DatabaseConnection::ParameterMap, LegalLogMgrPtr > > LegalLogMgrPool
LegalLogMgr pool.
uint64_t ManagerID
Manger ID used by hook libraries to retrieve respective LegalLogMgr instance.
Action
Describe what kind of event is being logged.
Defines the logger used by the top-level component of kea-lfc.