Search code examples
loggingelasticsearchlog4jsentry

Using sentry logging with elasticsearch


I try to store all the logs at sentry instance. Accordingly to this thread I tried the following:

Added sentry appender to loggin.yml:

es.logger.level: INFO
rootLogger: ${es.logger.level}, console, sentry
...
appender:
  console:
    type: console
    layout:
      type: consolePattern
      conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

  sentry: 
    type: net.kencochrane.raven.log4j.SentryAppender 
    dsn: "http://...@..."

And copied raven-5.0.jar, raven-log4j-5.0.jar and raven-logback-5.0.jar to es/lib folder. No errors during start but sentry has no records even with warning messages at console. ES's version is 2.1.0.

Do I miss something?


Solution

  • Here the valid solution (for ES 2.4.4):

    1. Add following libraries to lib folder of ES: raven-7.8.2.jar, raven-log4j-7.8.2.jar, slf4j-api-1.7.24.jar, slf4j-log4j12-1.7.24.jar
    2. Update config/logging.yml:

      rootLogger: ${es.logger.level}, console, file, sentry
      
      /* other appenders */
      
      sentry:
         type: com.getsentry.raven.log4j.SentryAppender 
         dsn: <DSN_HERE> 
         threshold: INFO
      
    3. Restart ES instance