UniSet 2.44.3
Класс uniset::LogDB

#include <LogDB.h>

Граф наследования:uniset::LogDB:
Граф связей класса uniset::LogDB:

Классы

class  Log
class  LogWebSocket
class  LogWebSocketGuard
class  LogDBRequestHandlerFactory

Открытые члены

 LogDB (const std::string &name, int argc, const char *const *argv, const std::string &prefix)
std::shared_ptr< DebugStreamlog ()
void run (bool async)
virtual void handleRequest (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp) override
void onWebSocketSession (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp)
void handleOverload (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp)
Открытые члены унаследованные от uniset::EventLoopServer
bool evIsActive () const noexcept

Открытые статические члены

static std::shared_ptr< LogDB > init_logdb (int argc, const char *const *argv, const std::string &prefix="logdb-")
static void help_print ()

Защищенные типы

typedef std::queue< std::string > QueryBuffer

Защищенные члены

virtual void evfinish () override
virtual void evprepare () override
void onCheckBuffer (ev::timer &t, int revents)
void onActivate (ev::async &watcher, int revents)
void addLog (Log *log, const std::string &txt)
void log2File (Log *log, const std::string &txt)
size_t getCountOfRecords (const std::string &logname="")
size_t getFirstOfOldRecord (size_t maxnum)
Poco::JSON::Object::Ptr respError (Poco::Net::HTTPServerResponse &resp, Poco::Net::HTTPResponse::HTTPStatus s, const std::string &message)
Poco::JSON::Object::Ptr httpGetRequest (Poco::Net::HTTPServerResponse &resp, const std::string &cmd, const Poco::URI::QueryParameters &p)
Poco::JSON::Object::Ptr httpGetList (Poco::Net::HTTPServerResponse &resp, const Poco::URI::QueryParameters &p)
Poco::JSON::Object::Ptr httpGetLogs (Poco::Net::HTTPServerResponse &resp, const Poco::URI::QueryParameters &p)
Poco::JSON::Object::Ptr httpGetCount (Poco::Net::HTTPServerResponse &resp, const Poco::URI::QueryParameters &p)
Poco::JSON::Object::Ptr httpGetStatus (Poco::Net::HTTPServerResponse &resp, const Poco::URI::QueryParameters &p)
Poco::JSON::Object::Ptr httpDownload (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp, const Poco::URI::QueryParameters &p)
Poco::JSON::Object::Ptr httpLogControl (std::ostream &out, Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp, const std::string &logname, const Poco::URI::QueryParameters &params)
void httpWebSocketPage (std::ostream &out, Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp, const Poco::URI::QueryParameters &p)
void httpWebSocketConnectPage (Poco::Net::HTTPServerRequest &req, Poco::Net::HTTPServerResponse &resp, const std::string &logname, const Poco::URI::QueryParameters &p)
bool supportsGzip (Poco::Net::HTTPServerRequest &request)
std::shared_ptr< LogWebSocketnewWebSocket (Poco::Net::HTTPServerRequest *req, Poco::Net::HTTPServerResponse *resp, const std::string &logname, const Poco::URI::QueryParameters &p)
void delWebSocket (std::shared_ptr< LogWebSocket > &ws)
void flushBuffer ()
void rotateDB ()
void onTerminate (ev::sig &evsig, int revents)
Защищенные члены унаследованные от uniset::EventLoopServer
bool async_evrun (size_t waitRunningTimeout_msec=60000)
void evstop ()
bool evrun ()

Защищенные статические члены

static std::string qEscapeString (const std::string &s)
static std::string qLast (const std::string &p)
static std::string qDate (const std::string &p, const char sep='-')

Защищенные данные

std::string myname
std::unique_ptr< SQLiteInterfacedb
std::string dbfile
std::string tmsFormat = { "localtime" }
bool activate = { false }
std::chrono::steady_clock::time_point startTime
QueryBuffer qbuf
size_t qbufSize = { 1000 }
ev::timer flushBufferTimer
double tmFlushBuffer_sec = { 1.0 }
size_t maxdbRecords = { 200 * 1000 }
size_t numOverflow = { 0 }
ev::sig sigTERM
ev::sig sigQUIT
ev::sig sigINT
ev::async wsactivate
std::shared_ptr< uniset::LogServerlogserv
std::string logserv_host = {""}
int logserv_port = {0}
std::vector< std::shared_ptr< Log > > logservers
std::shared_ptr< DebugStreamdblog
std::shared_ptr< Poco::Net::HTTPServer > httpserv
std::string httpHost = { "" }
int httpPort = { 0 }
std::string httpCORS_allow = { "*" }
std::string httpReplyAddr = { "" }
std::string httpJsonContentType = {"text/json; charset=UTF-8" }
std::string httpHtmlContentType = {"text/html; charset=UTF-8" }
std::string utf8Code = "UTF-8"
std::atomic< size_t > httpActiveRequests {0}
size_t httpMaxThreads = { 0 }
size_t httpMaxQueued = { 0 }
size_t httpMaxRequests = { 10 }
double wsHeartbeatTime_sec = { 3.0 }
double wsSendTime_sec = { 0.5 }
size_t wsMaxSend = { 200 }
double wsBackpressureTime_sec = { 15.0 }
size_t wsQueueBytesLimit = { 2 * 1024 * 1024 }
size_t wsFrameBytesLimit = { 64 * 1024 }
bool httpEnabledLogControl = { false }
bool httpEnabledDownload = { false }
double wsPongTimeout_sec = { 10.0 }
double wsMaxLifetime_sec = { 0 }
std::string wsPageTemplate = ""
std::list< std::shared_ptr< LogWebSocket > > wsocks
uniset::uniset_rwmutex wsocksMutex
size_t maxwsocks = { 50 }
Защищенные данные унаследованные от uniset::EventLoopServer
ev::dynamic_loop loop

Статические защищенные данные

static constexpr size_t reservedForMonitoring = 2

Друзья

class LogWebSocketGuard
class LogDBOverloadRequestHandler

Подробное описание

Реализация LogDB.

См. также
База логов (LogDB)

Методы

◆ evfinish()

void LogDB::evfinish ( )
overrideprotectedvirtual

Переопределяет метод предка uniset::EventLoopServer.

◆ evprepare()

void LogDB::evprepare ( )
overrideprotectedvirtual

Переопределяет метод предка uniset::EventLoopServer.

◆ help_print()

void LogDB::help_print ( )
static

глобальная функция для вывода help-а

◆ httpGetList()

Poco::JSON::Object::Ptr LogDB::httpGetList ( Poco::Net::HTTPServerResponse & resp,
const Poco::URI::QueryParameters & p )
protected

◆ init_logdb()

std::shared_ptr< LogDB > LogDB::init_logdb ( int argc,
const char *const * argv,
const std::string & prefix = "logdb-" )
static

глобальная функция для инициализации объекта

Данные класса

◆ tmsFormat

std::string uniset::LogDB::tmsFormat = { "localtime" }
protected

формат возвращаемого времени