0

How do I configure Loggly to work with elastic beanstalk and Tomcat 8?

The default script provided by Loggly to setup logging with Tomcat doesn't work because I get the error cannot find startup.sh I set CATALINA_HOME as /usr/share/tomcat8 but there is no .sh scripts that Loggly uses in the bin folder.

tt_Gantz
  • 2,786
  • 3
  • 23
  • 43

1 Answers1

0

This solution works but it will SLOW DOWN everything a lot as it will try to do a POST request each time it makes a log. So it works but I wouldn't recommend to use this.

You can follow the instruction for configuring a normal Java client instead found on https://yourusername.loggly.com/sources/setup/java_logback

Add the dependency, for maven it's like so

<dependency>
    <groupId>org.logback-extensions</groupId>
    <artifactId>logback-ext-loggly</artifactId>
    <version>0.1.2</version>
</dependency>

Install maven, in IntelliJ this can happen automatically, or simply run mvn clean install

Configure your logback.xml file to have the following (if you don't have one you'll need to configure slf4j or something and make one).

You may already have a <configuration> or <root> tags in place, then just slide in the <appender> and <appender-ref> lines into the right sections

<configuration debug="true">
    <appender name="loggly" class="ch.qos.logback.ext.loggly.LogglyAppender">
        <endpointUrl>http://logs-01.loggly.com/inputs/d1ad1d1f-7c77-449f-a541-bc56bd6af230/tag/logback</endpointUrl>
        <pattern>%d{"ISO8601", UTC}  %p %t %c{0}.%M - %m%n</pattern>
    </appender>
    <root level="info">
        <appender-ref ref="loggly" />
    </root>
</configuration>
Fabian N.
  • 3,807
  • 2
  • 23
  • 46
tt_Gantz
  • 2,786
  • 3
  • 23
  • 43