Reputation: 105
The situation is: we've got a number of working application instances, developed on C#
. We want them to log in one place (that could be a file). As far as I know log4net
and NLog
can send logs via TCP. The problem is - how to listen to these logs and store it?
Is there any working solution to collect these logs?
Upvotes: 5
Views: 3199
Reputation: 1464
It is better to use Application insights feature provided by MS. it can be used any language not just Microsoft languages. Application insights is divided into 2 parts. SDk for instrumenting telemetry(logs data) and visualizing these logs in azure dash boards. SDK is opensource and you need to pay for azure visualization tools. if you don't want to pay then use Application insgists in your code and send these logs to elastic stack which is open source
the best architecture
MS Application Insights -- for instrumenting logs
Apache Kafka -- acts as a pipeline and as temporary stoarge, send your logs to kafka
logstash-- a filter with which you can filter log
elasticsearch -- a no sql db to where the filtered data stored
kibana -- dash boards which pulls data from elastic and give vizualisations.
also you can link spark to kafka output to trigger alerts in form of emails, text messages.
Upvotes: 1
Reputation: 27608
In NLog you might consider the Database target. NLog has some other targets you might consider, including the LogReceiverService, which sends logging messages to a WCF Service or Web Service, where they can be logged to any of the NLog targets, including to a file.
In log4Net you might consider the AdoNetAppender. Configuration examples here.
I will note that, in the past, I implemented a WCF-based LoggingService (which is ultimately similar to NLog's LogReceiverService), which worked well for me.
Upvotes: 1
Reputation: 326
In log4Net you shoul configure appender, here official documentation see RemotingAppender
For the listen TCP you should use TcpListener like in this resource, there are exist some clients for log4net like this
Upvotes: 2