Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a C++ application running on dozens of short-term cloud instances that sometimes, but rarely, needs to issue an alert due to some extraordinary failure. This requires some kind of remote application logging system, with a centralized server to wait for and accumulate the logs.

This isn't an uncommon need, tet, surprisingly, it's quite unclear how to proceed. Even after extensive googling, nearly all logging tools and discussion focus on forwarding system logs (often with rsyslog), not application data, or using very heavy, complex, and (often commercial) overkill tools like POCO, SPLUNK, and Log4cxx.

Currently I am embarassed to say, issuing system() wget http requests with my logging string embedded in the URL, and just parsing the server's HTTP log. I'd even continue doing this except for 1) the HTTP server is actually hosting more than just my log inputs, and 2) I can't send arbitrary strings since they have to be re-formatted to pass HTTP request length and character encoding limits.

Speed, scalability, and versatility are not too important. Simplicity is. I'm happiest with a single C++ header that exposes a single function that I provide an IP address and a plain ASCII string, and a server at that address merely concatinates all the strings it receives from all senders. Yet I cannot find such a simple system or even example.

My question to the community: What's the simplest C++ tool/header/library method for this barebones application logging requirement of "remote C++ application, very rarely, may send a single string to a server which merely concatinates all the strings it receives into a file."?

What I have tried:

My question to the community: What's the simplest C++ tool/header/library method for this barebones application logging requirement of "remote C++ application, very rarely, may send a single string to a server which merely concatinates all the strings it receives into a file."?
Posted
Updated 16-Oct-17 3:46am
Comments
Peter_in_2780 10-Oct-17 7:31am    
Why not adapt your current technology slightly? Use HTTP POST to get around length limits and funny character restrictions. On the server, append the POST data to a text file you can dump out from time to time.
You could add stuff at the server, like a time stamp, IP source address, etc.

1 solution

You can simply send syslog messages using UDP to a syslog server that accepts remote connections: RFC 5426 - Transmission of Syslog Messages over UDP[^].

This method is used by many embedded devices like routers, switches, network printers when offering a remote logging option.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900