GithubHelp home page GithubHelp logo

isabella232 / awesolog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from salesforce/awesolog

0.0 0.0 0.0 16 KB

Policies for logback logger rolling appender that ships logs to S3

License: BSD 3-Clause "New" or "Revised" License

Java 70.58% Scala 29.42%

awesolog's Introduction

awesolog

CircleCI

Policies for logback logger rolling appender that ships logs to S3. The program needs to be imported as a standard maven library.

The S3FixedWindowRollingPolicy is implemented that extends FixedWindowRollingPolicy in Logback, therefore the behaviour is the same between the two except for uploading the log files to s3.

Key values are used in default config (usually application.conf) before getting overridden with any corresponding key values set in logback.xml.

Logback XML Key Config Key
awsAccessKey aws_access_key_id
awsSecretKey aws_secret_access_key
s3BucketName s3_egress_bucket
s3FolderName s3_log_folder_path
s3Region aws_current_region

Logback XML

An example logback.xml that uses S3FixedWindowRollingPolicy with RollingFileAppender.

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>/log/myapp.log</file>
    <encoder>
        <pattern>%date{yyyy-MM-dd HH:mm:ss ZZZZ} - %message%n%xException</pattern>
    </encoder>

    <!--
      Policy to upload a log file into S3 on log rolling or JVM exit.
      - On each log rolling, a rolled log file is created locally and uploaded to S3
      - When <rollingOnExit> is true, log rolling occurs on JVM exit and a rolled log is uploaded
      - When <rollingOnExit> is false, the active log file is uploaded as it is
    -->
    <rollingPolicy class="com.salesforce.mce.awesolog.S3FixedWindowRollingPolicy">
        <fileNamePattern>/log/myapp-log-%i.gz</fileNamePattern>
        <awsAccessKey>accesskey</awsAccessKey>
        <awsSecretKey>secretkey</awsSecretKey>
        <s3BucketName>bucketName</s3BucketName>
        <s3FolderName>logs</s3FolderName>
        <rollingOnExit>true</rollingOnExit>
    </rollingPolicy>
    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
        <maxFileSize>10KB</maxFileSize>
    </triggeringPolicy>
</appender>

Default Config

An example application.conf file that can be used to set the values.

aws_access_key_id = xxxxxxxxxxxxx
aws_secret_access_key = xxxxxxxxxxxxx
s3_egress_bucket = bucketName
s3_log_folder_path = example/logs/
aws_current_region = region

awesolog's People

Contributors

damianxu88 avatar realstraw avatar svc-scm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.