e-switch-Solutions-AG/logback-http-appender


Download


Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}
	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.schelldorfer:logback-http-appender:0.3.6-SNAPSHOT'
	}
	<dependency>
	    <groupId>com.github.schelldorfer</groupId>
	    <artifactId>logback-http-appender</artifactId>
	    <version>0.3.6-SNAPSHOT</version>
	</dependency>

                            
    libraryDependencies += "com.github.schelldorfer" % "logback-http-appender" % "0.3.6-SNAPSHOT"
        
        

                            
    :dependencies [[com.github.schelldorfer/logback-http-appender "0.3.6-SNAPSHOT"]]
        
        

Readme


logback-http-appender

Build Status

How to use

<appender name="STASH" class="tw.kewang.logback.appender.HttpAuthenticationAppender">
				<protocol>https</protocol>
				<url>localhost</url>
				<port>443</port>
				<path>/logs/logstash</path>
				<authentication>
					<username>username</username>
					<password>senha</password>
				</authentication>
				<reconnectDelay>10</reconnectDelay>
				
				<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">        
					<providers>
						<mdc/> <!-- MDC variables on the Thread will be written as JSON fields--> 
						<context/> <!--Outputs entries from logback's context -->                               
						<version/> <!-- Logstash json format version, the @version field in the output-->
						<logLevel/>
						<loggerName/>
						<pattern>
							<pattern> <!-- we can add some custom fields to be sent with all the log entries make filtering easier in Logstash   -->               
								{
								"appName": "upp-quality-control-framework-ws"	<!--or searching with Kibana-->
								}
							</pattern>
						</pattern>
		
						<threadName/>
						<message/>
						
						<logstashMarkers/> <!-- Useful so we can add extra information for specific log lines as Markers--> 
						<arguments/> <!--or through StructuredArguments-->
						
						<stackTrace/>
					</providers>
				</encoder>
			</appender>

References