logbackloggly

Loggly: Grouping using LogglyBatchAppender?


We have a Scala Play app and we are using the LogglyBatchAppender. But, all our environments (dev, staging, prod) logs are being mixed up on loggly. This says we can group by sources or hostnames or tags but hostname info is not being attached to outgoing loggly messages and this wiki page says nothing about how to attach tags in the LogglyBatchAppender (it does mention how to tag using the slower LogglyAppender). What is the best way to see different host/env logs in loggly if we are using the LogglyBatchAppender?


Solution

  • Hi you can set the endpointUrl in LogglyBatchAppender. When you set the URL make sure the include the tag at the end of it. You can tag them for dev/staging/prod. This way you can use Loggly's source groups.

    Example with a prod tag. Remember to replace with your own customer token:

    <configuration>
        <appender name="logglyAppender" class="ch.qos.logback.ext.loggly.LogglyBatchAppender">
            <endpointUrl>http://logs-01.loggly.com/inputs/YOUR-CUSTOMER-TOKEN/tag/prod/</endpointUrl>
            ...
        </appender>
    </configuration>