Hello All,

How can i filter the logs from a particular server and display that using a C++ code. I have logs coming from multiple server and i want to display logs from only one server. How to do that ?? How should i apply filter in c++, with a condition that I don't want to use inbuilt libraries like boost and so many others.

Please, help me with some sort of code. It would be great help.


3 Years
Discussion Span
Last Post by L7Sqr

This is highly dependent on the environment, logs, and the filtering you'd like to do. Limititng yourself to not using existing libraries makes for a difficult journey.

How are you getting these logs? Individually over a socket connection? As a single file with all server logs aggregated in one place? Do you need to connect to the server to request the logs? Are they provided to you periodically?

The more detail you can provide the more we can help you with your problem.


I am getting the logs through socket connection only and that will be stored in the vector container. What we have is the logs coming from multiple servers and we need to filter it out for the particular server say "XYZ". I don't know how to do that.


A vector of what? A vector of strings? If each string contains the server name in it, you can just remove every string that doesn't contain that name.


Presumably, each server has it's own connection (i.e. individual, unique port and/or IP address) and you could easily just filter on that.

If all you have is some std::vector< std::string > then you need to determine what is unique in each message that can identify the server you want to filter for.

In either case, you determine what is unique to the server you want to monitor and use that to drive your filtering rules.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.