Sample Java Program for Elastic search,Kibana and FluentD

1] Download the below Dependency Jars:

a] fluent-logger-0.3.5-SNAPSHOT

b] javassist.jar

c] logback.jar

d] logback-core-0.9.6.jar

e] msgpack-0.6.7.jar

f] slf4j-api-1.6.0.jar

g] slf4j-nop-1.6.1.jar

2] Simple Java Program

import java.util.HashMap;
import java.util.Map;
import org.fluentd.logger.FluentLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.fluentd.logger.sender.*;

public class Main {

private static FluentLogger LOG = FluentLogger.getLogger(“Demo”,”localhost”,24224);

//private static Logger logger = LoggerFactory.getLogger(null);

public void doApplicationLogic() {

Sender sender = new RawSocketSender(“localhost”, 24224);
Map<String, Object> data = new HashMap<String, Object>();
data.put(“KEY1”, “INFO : This is the INFORMATION Log !!!”);
data.put(“KEY2”, “WARN : This is the WARNING Log !!!”);
data.put(“KEY3”, “ERROR : This is the ERROR Log !!!”);
LOG.log(“follow”, data);
sender.emit(“demo.label1”, data);

HashMap<String,Object> hm = new HashMap<String,Object>();
hm.put(“DEMO”,”INFO:THIS IS LOG”);
sender.emit(“demo.label1”, hm);

public static void main(String[] args)
new Main().doApplicationLogic();

3] Run the Program and set the dependency jars in class path

About ashokabhat

I am a C,C ,JAVA,Adobe Flex,.NET Programmer Currently working as a Software Developer
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s