com.github.wmifsud.sumo:sumo-logback-appender

Forked project which pushes logs to sumo-logic in json format

License

License

Categories

Categories

Logback Application Layer Libs Logging
GroupId

GroupId

com.github.wmifsud.sumo
ArtifactId

ArtifactId

sumo-logback-appender
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

com.github.wmifsud.sumo:sumo-logback-appender
Forked project which pushes logs to sumo-logic in json format
Project URL

Project URL

http://github.com/wmifsud/sumo-logback-appender
Source Code Management

Source Code Management

http://github.com/wmifsud/sumo-logback-appender/tree/master

Download sumo-logback-appender

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.wmifsud.sumo/sumo-logback-appender/ -->
<dependency>
    <groupId>com.github.wmifsud.sumo</groupId>
    <artifactId>sumo-logback-appender</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.wmifsud.sumo/sumo-logback-appender/
implementation 'com.github.wmifsud.sumo:sumo-logback-appender:1.1.0'
// https://jarcasting.com/artifacts/com.github.wmifsud.sumo/sumo-logback-appender/
implementation ("com.github.wmifsud.sumo:sumo-logback-appender:1.1.0")
'com.github.wmifsud.sumo:sumo-logback-appender:jar:1.1.0'
<dependency org="com.github.wmifsud.sumo" name="sumo-logback-appender" rev="1.1.0">
  <artifact name="sumo-logback-appender" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.wmifsud.sumo', module='sumo-logback-appender', version='1.1.0')
)
libraryDependencies += "com.github.wmifsud.sumo" % "sumo-logback-appender" % "1.1.0"
[com.github.wmifsud.sumo/sumo-logback-appender "1.1.0"]

Dependencies

compile (5)

Group / Artifact Type Version
org.apache.httpcomponents : httpclient jar 4.4.1
ch.qos.logback : logback-classic jar 1.1.3
junit : junit jar 4.12
ch.qos.logback.contrib : logback-json-classic jar 0.1.5
ch.qos.logback.contrib : logback-jackson jar 0.1.5

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.6

Project Modules

There are no modules declared in this project.

sumo-logback-appender

A logback appender that sends logs in json format straight to Sumo Logic.

HOW-TO-USE

  1. Add the following dependency to your application:

     <dependency>
         <groupId>com.github.wmifsud.sumo</groupId>
         <artifactId>sumo-logback-appender</artifactId>
         <version>1.1.0-SNAPSHOT</version>
     </dependency>
    
  2. Add the following logback-spring.xml to your application:

     <?xml version="1.0" encoding="UTF-8"?>
     <configuration scan="true">
         <!-- To enable JMX Management -->
         <jmxConfigurator/>
     
         <include resource="org/springframework/boot/logging/logback/base.xml"/>
     
         <logger name="org.springframework.web" level="INFO"/>
         <logger name="org.springframework.data" level="INFO"/>
         <logger name="org.hibernate.SQL" level="INFO"/>
         <springProfile name="!local">
     
             <property scope="context" name="git_tags" value="${git.tags}"/>
             <property scope="context" name="git_branch" value="${git.branch}"/>
             <property scope="context" name="git_version_id" value="${git.version.id}"/>
     
             <springProperty scope="context" name="application_component_name" source="spring.application.name"/>
             <springProperty name="sumo_logic_url" source="sumo.logic.url"/>
     
             <appender name="sumoLogicAppender" class="com.sumologic.logback.BufferedSumoLogicAppender">
                 <url>${sumo_logic_url}</url>
                 <messagesPerRequest>1</messagesPerRequest>
                 <layout class="com.sumologic.logback.json.CustomJsonLayout">
                     <includeMDC>false</includeMDC>
                     <jsonFormatter class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter">
                         <prettyPrint>false</prettyPrint>
                     </jsonFormatter>
                     <timestampFormat>yyyy-MM-dd' 'HH:mm:ss.SSS' 'Z</timestampFormat>
                     <appendLineSeparator>true</appendLineSeparator>
                 </layout>
             </appender>
     
             <root level="INFO">
                 <appender-ref ref="sumoLogicAppender"/>
             </root>
         </springProfile>
     </configuration>
    
  3. Add the following property to your application/bootstrap.yml file where logs will be posted to:

     sumo.logic.url=${your_sumo_logic_url_collector}
    

Versions

Version
1.1.0