From d38e4ca2fcd6df604f4977fe537d2810b752b86b Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Sun, 9 Jan 2022 22:35:50 -0800 Subject: [PATCH] Logging and framework update --- build | 2 +- owsec.properties | 38 +++------------------------ src/RESTObjects/RESTAPI_GWobjects.cpp | 4 +++ src/RESTObjects/RESTAPI_GWobjects.h | 4 +++ src/framework/KafkaTopics.h | 1 + src/framework/RESTAPI_protocol.h | 1 + 6 files changed, 14 insertions(+), 36 deletions(-) diff --git a/build b/build index 80945bc..3021b56 100644 --- a/build +++ b/build @@ -1 +1 @@ -183 \ No newline at end of file +184 \ No newline at end of file diff --git a/owsec.properties b/owsec.properties index 65e6ab5..7d7b305 100644 --- a/owsec.properties +++ b/owsec.properties @@ -118,44 +118,12 @@ storage.type.mysql.database = ucentral storage.type.mysql.port = 3306 storage.type.mysql.connectiontimeout = 60 - ######################################################################## ######################################################################## # # Logging: please leave as is for now. # ######################################################################## -logging.formatters.f1.class = PatternFormatter -logging.formatters.f1.pattern = %s: [%p] %t -logging.formatters.f1.times = UTC -logging.channels.c1.class = ConsoleChannel -logging.channels.c1.formatter = f1 - -# This is where the logs will be written. This path MUST exist -logging.channels.c2.class = FileChannel -logging.channels.c2.path = $OWSEC_ROOT/logs/log -logging.channels.c2.formatter.class = PatternFormatter -logging.channels.c2.formatter.pattern = %Y-%m-%d %H:%M:%S %s: [%p] %t -logging.channels.c2.rotation = 20 M -logging.channels.c2.archive = timestamp -logging.channels.c2.purgeCount = 20 -logging.channels.c3.class = ConsoleChannel -logging.channels.c3.pattern = %s: [%p] %t - -# External Channel -logging.loggers.root.channel = c2 -logging.loggers.root.level = debug - -# Inline Channel with PatternFormatter -# logging.loggers.l1.name = logger1 -# logging.loggers.l1.channel.class = ConsoleChannel -# logging.loggers.l1.channel.pattern = %s: [%p] %t -# logging.loggers.l1.level = information -# SplitterChannel -# logging.channels.splitter.class = SplitterChannel -# logging.channels.splitter.channels = l1,l2 -# logging.loggers.l2.name = logger2 -# logging.loggers.l2.channel = splitter - - - +logging.type = file +logging.path = $OWSEC_ROOT/logs +logging.level = debug \ No newline at end of file diff --git a/src/RESTObjects/RESTAPI_GWobjects.cpp b/src/RESTObjects/RESTAPI_GWobjects.cpp index 0e2fe66..be66a0a 100644 --- a/src/RESTObjects/RESTAPI_GWobjects.cpp +++ b/src/RESTObjects/RESTAPI_GWobjects.cpp @@ -192,6 +192,10 @@ namespace OpenWifi::GWObjects { field_to_json(Obj,"lastContact", LastContact); field_to_json(Obj,"associations_2G", Associations_2G); field_to_json(Obj,"associations_5G", Associations_5G); + field_to_json(Obj,"webSocketClients", webSocketClients); + field_to_json(Obj,"websocketPackets", websocketPackets); + field_to_json(Obj,"kafkaClients", kafkaClients); + field_to_json(Obj,"kafkaPackets", kafkaPackets); switch(VerifiedCertificate) { case NO_CERTIFICATE: diff --git a/src/RESTObjects/RESTAPI_GWobjects.h b/src/RESTObjects/RESTAPI_GWobjects.h index e824d04..dfc0ca2 100644 --- a/src/RESTObjects/RESTAPI_GWobjects.h +++ b/src/RESTObjects/RESTAPI_GWobjects.h @@ -34,6 +34,10 @@ namespace OpenWifi::GWObjects { std::string Firmware; CertificateValidation VerifiedCertificate = NO_CERTIFICATE; std::string Compatible; + uint64_t kafkaClients=0; + uint64_t webSocketClients=0; + uint64_t kafkaPackets=0; + uint64_t websocketPackets=0; void to_json(Poco::JSON::Object &Obj) const; }; diff --git a/src/framework/KafkaTopics.h b/src/framework/KafkaTopics.h index 393b355..6be2ba5 100644 --- a/src/framework/KafkaTopics.h +++ b/src/framework/KafkaTopics.h @@ -17,6 +17,7 @@ namespace OpenWifi::KafkaTopics { static const std::string COMMAND{"command"}; static const std::string SERVICE_EVENTS{"service_events"}; static const std::string DEVICE_EVENT_QUEUE{"device_event_queue"}; + static const std::string DEVICE_TELEMETRY{"device_telemetry"}; namespace ServiceEvents { static const std::string EVENT_JOIN{"join"}; diff --git a/src/framework/RESTAPI_protocol.h b/src/framework/RESTAPI_protocol.h index fdfe4b5..664a91d 100644 --- a/src/framework/RESTAPI_protocol.h +++ b/src/framework/RESTAPI_protocol.h @@ -84,6 +84,7 @@ namespace OpenWifi::RESTAPI::Protocol { static const char * GETSUBSYSTEMNAMES = "getsubsystemnames"; static const char * GETLOGLEVELNAMES = "getloglevelnames"; static const char * STATS = "stats"; + static const char * PING = "ping"; static const char * PARAMETERS = "parameters"; static const char * VALUE = "value"; static const char * LASTONLY = "lastOnly";