Skip to content

log4net appender to Kafka and provide logstash json_event PatternLayout

License

Notifications You must be signed in to change notification settings

Berreek/log4net.Kafka

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log4net.Kafka

log4net.Kafka provide kafka appender, also provide logstash json_event PatternLayout.

Getting Started

Step 1: Install log4net.Kafka package

Install-Package log4net.Kafka

Step 2: Configure log4net sections

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
	<appender name="KafkaAppender" type="log4net.Kafka.KafkaAppender, log4net.Kafka">
		<KafkaSettings>
			<brokers>
				<add value="http://kafka:9092" />
			</brokers>
			<topic type="log4net.Layout.PatternLayout">
				<!--<conversionPattern value="kafka.logstash.%level" />-->
				<conversionPattern value="kafka.logstash.DEBUG" />
			</topic>
		</KafkaSettings>

		<!--<layout type="log4net.Layout.PatternLayout">
			<conversionPattern value="%d [%t] %-5p %c %m%n" />
		</layout>-->
		<layout type="log4net.Kafka.LogstashLayout,log4net.Kafka" >
			<app value="erp.logs" />
		</layout>
	</appender>
	<root>
		<level value="DEBUG"/>
		<appender-ref ref="KafkaAppender" />
	</root>
</log4net>

How to use log4net.Kafka without logstash?

Using layout log4net.Layout.PatternLayout to instead log4net.Kafka.LogstashLayout.

About

log4net appender to Kafka and provide logstash json_event PatternLayout

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%