Integration Guide for Logpulse

Follow this guide to integrate Logpulse with your application and start visualizing your logs in real-time.

Prerequisites

1. Add the Log Analyzer Client Dependency

Maven Configuration

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.koushikruidas</groupId>
    <artifactId>log-analyzer-client</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle Configuration

Add the following to your build.gradle:

dependencies {
    implementation 'io.github.koushikruidas:log-analyzer-client:1.0.0'
}

📌 Need Help?

Having trouble with the integration? Our support team is here to help! Contact us at support@logpulse.io

2. Configure Log4j2

Create or update log4j2.xml in src/main/resources with properties for Kafka, TLS and the Logpulse admin URL. Example:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" name="spring-boot-kafka-log">
  <Properties>
    <Property name="bootstrap.servers">${env:KAFKA_SERVERS}</Property>
    <Property name="apiKey">${env:LOG_ANALYZER_TOKEN}</Property>
  </Properties>
  <Appenders>
    <Kafka name="Kafka" topic="${kafka.topic}">
      <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/>
    </Kafka>
  </Appenders>
  <Loggers>
    <Root level="info">
      <AppenderRef ref="Kafka"/>
    </Root>
  </Loggers>
</Configuration>

3. Enable Component Scanning for the Log Analyzer Client

In your main application class, add @ComponentScan:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan(basePackages = {"com.poinciana.loganalyzerClient"})
public class GenerateLogsApplication {
  public static void main(String[] args) {
    SpringApplication.run(GenerateLogsApplication.class, args);
  }
}

4. Get Kafka and Logpulse Credentials

To obtain Kafka details (topic name, hosts, certificates, username, password, and token), please contact: koushikruidas@gmail.com

5. Run Your Application

Build and run your application as usual. Your logs will be sent to logpulse.io via the configured Kafka appender.

6. Troubleshooting