-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Initial changes for windoes event reader and fix file test for …
…windows
- Loading branch information
1 parent
2a0056b
commit 5eb5ec3
Showing
14 changed files
with
272 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#pragma once | ||
|
||
#include <boost/asio/awaitable.hpp> | ||
#include <logcollector.hpp> | ||
|
||
namespace logcollector { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "we_reader_win.hpp" | ||
|
||
#include <logger.hpp> | ||
|
||
using namespace logcollector; | ||
|
||
WindowsEventTracerReader::WindowsEventTracerReader(Logcollector &logcollector, | ||
const std::list<std::string> channels, | ||
const std::list<std::string> queries, | ||
const std::time_t reloadInterval, | ||
bool bookmarkEnabled) : | ||
IReader(logcollector), | ||
m_channelsList(channels), | ||
m_queriesList(queries), | ||
m_ReaderReloadInterval(reloadInterval), | ||
m_bookmarkEnabled(bookmarkEnabled) { } | ||
|
||
Awaitable WindowsEventTracerReader::Run() | ||
{ | ||
// TODO: add lambda for loop break | ||
while (true) { | ||
m_logcollector.EnqueueTask(ReadEventChannel()); | ||
|
||
co_await m_logcollector.Wait( | ||
std::chrono::milliseconds(m_ReaderReloadInterval)); | ||
} | ||
} | ||
|
||
Awaitable WindowsEventTracerReader::ReadEventChannel() | ||
{ | ||
for (auto eventChannel : m_channelsList) | ||
{ | ||
const std::string log {}; | ||
m_logcollector.SendMessage(eventChannel, log, m_collectorType); | ||
|
||
co_await m_logcollector.Wait(std::chrono::milliseconds(m_ReaderReloadInterval)); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#ifdef _WIN32 | ||
#pragma once | ||
|
||
#include <ctime> | ||
#include <list> | ||
#include <string> | ||
|
||
#include "reader.hpp" | ||
|
||
namespace logcollector { | ||
|
||
/// @brief Windows Event Tracer Reader class | ||
/// TODO: doc | ||
class WindowsEventTracerReader : public IReader | ||
{ | ||
public: | ||
/// @brief Constructor for the Windows Event Tracer Reader | ||
/// @param logcollector Log collector instance | ||
/// @param channels List of channel names | ||
/// @param queries List of queries | ||
/// @param reloadInterval | ||
/// @param bookmarkEnabled | ||
WindowsEventTracerReader(Logcollector &logcollector, | ||
const std::list<std::string> channels, | ||
const std::list<std::string> queries, | ||
const std::time_t reloadInterval, | ||
bool bookmarkEnabled); | ||
|
||
/// @brief Runs the file reader | ||
/// @return Awaitable result | ||
Awaitable Run() override; | ||
|
||
// TODO: doc | ||
Awaitable ReadEventChannel(); | ||
|
||
private: | ||
/// @brief | ||
std::time_t m_ReaderReloadInterval; | ||
|
||
std::list<std::string> m_channelsList; | ||
|
||
std::list<std::string> m_queriesList; | ||
|
||
bool m_bookmarkEnabled; | ||
|
||
int m_availableEvents = 0; | ||
|
||
const std::string m_collectorType = "eventchannel"; | ||
}; | ||
|
||
} // namespace logcollector | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.