Barebones远程应用程序日志记录 [英] Barebones remote application logging

查看:91
本文介绍了Barebones远程应用程序日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C ++应用程序在几十个短期云实例上运行,有时但很少需要发出警报,因为一些特殊的失败。这需要某种远程应用程序日志系统,中央服务器等待并累积日志。



这不是一个不常见的需求,tet,令人惊讶的是,目前还不清楚如何继续。即使经过大量的谷歌搜索,几乎所有的日志工具和讨论都集中在转发系统日志(通常使用rsyslog),而不是应用程序数据,或使用非常繁重,复杂和(通常是商业的)过度杀伤工具,如POCO,SPLUNK和Log4cxx。 />


目前我很尴尬地说,发出system()wget http请求,我的日志字符串嵌入在URL中,只是解析服务器的HTTP日志。我甚至会继续这样做,除了1)HTTP服务器实际上托管的不仅仅是我的日志输入,2)我不能发送任意字符串,因为它们必须重新格式化以传递HTTP请求长度和字符编码限制。



速度,可扩展性和多功能性并不太重要。简单就是。我最开心的是单个C ++标头暴露了我提供IP地址和普通ASCII字符串的单个函数,而该地址的服务器只是汇总了从所有发件人收到的所有字符串。然而,我找不到这么简单的系统甚至是例子。



我向社区提出的问题:这个准系统应用程序日志记录要求的最简单的C ++工具/头/库方法是什么远程C ++应用程序,很少,可以将一个字符串发送到服务器,只将它收到的所有字符串合并到一个文件中。?



我尝试了什么:



我向社区提出的问题:对于这个准确的远程应用程序日志记录要求,最简单的C ++工具/头/库方法是什么很少有C ++应用程序可以向服务器发送一个字符串,只将它收到的所有字符串合并到一个文件中。?

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."?

推荐答案

你可以简单地发送syslog使用UDP到接受远程连接的syslog服务器的消息: RFC 5426 - 通过UDP传输Syslog消息 [ ^ ]。



许多嵌入式设备(如路由器,交换机)都使用此方法,网络打印机提供远程日志记录选项。
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.


这篇关于Barebones远程应用程序日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆