openmainframeproject / ade

ADE detects anomalous time slices and messages in Linux logs (either RFC3164 or RFC5424 format) using statistical learning.
https://www.openmainframeproject.org/projects/anomaly-detection-engine-for-linux-logs-ade
GNU General Public License v3.0
51 stars 34 forks source link

usage #64

Open vonavage opened 5 years ago

vonavage commented 5 years ago

how to use the rfc5434 parser in a standalone app? it fails with slf4j error or missing class

caffreyj commented 5 years ago

To document my private response.

Could you send me the java exception stack? I suspect that the you need to include some of the error logging code, the exception stack is likely to confirm that. One I understand the problem I can probably suggest a solution

From: vonavage notifications@github.com To: openmainframeproject/ade ade@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Date: 11/30/2018 02:41 AM Subject: [openmainframeproject/ade] usage (#64)

how to use the rfc5434 parser in a standalone app? it fails with slf4j error or missing class

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

vonavage commented 5 years ago

@caffreyj

I'm not sure how to invoke this... I tried as follows... using "Test" class in org.openmainframe.ade.ext.os.parser ... but, obviously will separate it out in package outside org.openmainframe.ade.ext.os.parser `package org.openmainframe.ade.ext.os.parser; //import org.openmainframe.ade.ext.os.parser.LinuxSyslog5424ParserBase;

public class Test { public static void main(String args[]) { LinuxSyslog5424ParserBase ls5424pb = new LinuxSyslog5424ParserBase();

    String syslogWithNilPid = "<46>1 2014-05-30T08:52:40.620950-04:00 host-name rsyslogd - - - rsyslogd's groupid changed to 103";

    ls5424pb.parseLine(syslogWithNilPid);
}

} `

I did "mvn clean package" and got the output as follows:- INFO] Reactor Summary: [INFO] [INFO] ade ................................................ SUCCESS [ 0.191 s] [INFO] ade-core ........................................... SUCCESS [ 31.060 s] [INFO] ade-ext ............................................ SUCCESS [ 16.538 s] [INFO] ade-assembly ....................................... SUCCESS [ 1.945 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 49.845 s [INFO] Finished at: 2018-11-29T21:51:06-08:00 [INFO] Final Memory: 38M/666M [INFO] ------------------------------------------------------------------------

java -cp ./ade-ext/target/ade-ext-1.0.4.jar org.openmainframe.ade.ext.os.parser.Test

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at org.openmainframe.ade.ext.os.parser.LinuxSyslogLineParser.<clinit>(LinuxSyslogLineParser.java:45) at org.openmainframe.ade.ext.os.parser.Test.main(Test.java:8) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadCl

vonavage commented 5 years ago

just to give the task that I'm trying is

caffreyj commented 5 years ago

There are a set of jar files which the maven obtains when it builds an ADE image. You will probably need to include those jar file in the class path for your parse code. Here is a list of the jar which is used by ADE. http://openmainframeproject.github.io/ade/open_source_used.html

vonavage commented 5 years ago

Thank you.. will use it