<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Java Logger and Splunk Class HttpEventCollectorLoggingHandler not working, forwarding to HEC + Splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Java-Logger-and-Splunk-Class-HttpEventCollectorLoggingHandler/m-p/486408#M195681</link>
    <description>&lt;P&gt;I reduced content of my documentation of problem (Code and Trace), due to request from Splunk, &lt;/P&gt;

&lt;P&gt;I'm trying to log to the Splunk via the HEC using java.util.logging and Splunk Handler Class HttpEventCollectorLoggingHandler.&lt;/P&gt;

&lt;P&gt;The events don't appear to be forwarded to Splunk.  Also It looks to stopping in the SSL Handshake; I have a GUID specified in the properties file; the properties used for the Splunk Class are echoed out in the console log.&lt;/P&gt;

&lt;P&gt;Logging to a different HTTP listener look to work OK; my play Java Http listener to echo sent logger data, &lt;/P&gt;

&lt;P&gt;The Java Program Source and the Console Log, are pasted below.&lt;/P&gt;

&lt;P&gt;Using Eclipse Java Development environment; Build Path has the following Jar Files:&lt;/P&gt;

&lt;P&gt;•      splunk-sdk-java-1.6.5.jar&lt;BR /&gt;
•      okhttp-3.12.8.jar &lt;BR /&gt;
•      okio-1.13.0.jar &lt;BR /&gt;
•      com.google.gson classes &lt;/P&gt;

&lt;P&gt;I'm also using  splunk-library-javalogging-1.8.0.zip  classes, for classes not included in the splunk .jar file.&lt;/P&gt;

&lt;P&gt;The program compiles clean.&lt;/P&gt;

&lt;P&gt;It looks to stop in the SSL handshake after "done seeding SecureRandom"; last entry in the console log.&lt;BR /&gt;
I'm running with these arguments passed to the program, for debugging and properties file,&lt;/P&gt;

&lt;P&gt;-Djava.util.logging.config.file=C:\Explorer_Exports\jdklogging.properties  -Xdebug -Djavax.net.debug=all&lt;/P&gt;

&lt;P&gt;Was wondering if I'm using the proper .jar files in build path; classes from the .zip file, or my logger setup may be incorrect.&lt;/P&gt;

&lt;P&gt;Any assistance would be appreciated.  Steve.&lt;/P&gt;

&lt;P&gt;==  S O U R C E    C O D E ===========================================================================&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;//                                                               
package com.mycompany.logging;                               
import java.io.*;  
import java.util.logging.*;                                      
import com.splunk.logging.*;  
import com.splunk.logging.SplunkCimLogEvent; 
//      

public class LogTestSplunk{ 

  public static void main(String arg[]) throws IOException {   
  Logger logger = Logger.getLogger("splunklogger");
   SplunkCimLogEvent event = new SplunkCimLogEvent("zCEE", "PostInvokeSAK");
   //*************************************************************
   // Splunk Handler
   Handler shandler = new HttpEventCollectorLoggingHandler();
   logger.addHandler(shandler);
   // echo out properties here...
   //....
   // continue with logger code.
    event.setAuthApp("jane");                                             
    event.setAuthUser("jane");                                            
event.addField("message", "this is my test message foobar");
    logger.info(event.toString()); 
  }                                                                      
}                                                                             
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;== C O N S O L E     L O G ====================================================================&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Property - com.splunk.logging.HttpEventCollectorLoggingHandler.url:== &lt;A href="https://hecdevsplunk.aetna.com:8088/services/collector/event" target="test_blank"&gt;https://hecdevsplunk.aetna.com:8088/services/collector/event&lt;/A&gt;
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.level:== INFO
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.token:== adee79d5-774e-4cff-9596-d7e2a52b4f5f
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.source:== http:zOS_java
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.sourcetype:== httpevent 
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.messageFormat:== text
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.index:== webeng-websphere
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.disableCertificateValidation:== false
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.retries_on_error:== 00001

--- all the SSL handshake here ---  final SSL trace entry is this:
done seeding SecureRandom
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 Mar 2020 16:42:21 GMT</pubDate>
    <dc:creator>steveIMS</dc:creator>
    <dc:date>2020-03-05T16:42:21Z</dc:date>
    <item>
      <title>Java Logger and Splunk Class HttpEventCollectorLoggingHandler not working, forwarding to HEC + Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Java-Logger-and-Splunk-Class-HttpEventCollectorLoggingHandler/m-p/486408#M195681</link>
      <description>&lt;P&gt;I reduced content of my documentation of problem (Code and Trace), due to request from Splunk, &lt;/P&gt;

&lt;P&gt;I'm trying to log to the Splunk via the HEC using java.util.logging and Splunk Handler Class HttpEventCollectorLoggingHandler.&lt;/P&gt;

&lt;P&gt;The events don't appear to be forwarded to Splunk.  Also It looks to stopping in the SSL Handshake; I have a GUID specified in the properties file; the properties used for the Splunk Class are echoed out in the console log.&lt;/P&gt;

&lt;P&gt;Logging to a different HTTP listener look to work OK; my play Java Http listener to echo sent logger data, &lt;/P&gt;

&lt;P&gt;The Java Program Source and the Console Log, are pasted below.&lt;/P&gt;

&lt;P&gt;Using Eclipse Java Development environment; Build Path has the following Jar Files:&lt;/P&gt;

&lt;P&gt;•      splunk-sdk-java-1.6.5.jar&lt;BR /&gt;
•      okhttp-3.12.8.jar &lt;BR /&gt;
•      okio-1.13.0.jar &lt;BR /&gt;
•      com.google.gson classes &lt;/P&gt;

&lt;P&gt;I'm also using  splunk-library-javalogging-1.8.0.zip  classes, for classes not included in the splunk .jar file.&lt;/P&gt;

&lt;P&gt;The program compiles clean.&lt;/P&gt;

&lt;P&gt;It looks to stop in the SSL handshake after "done seeding SecureRandom"; last entry in the console log.&lt;BR /&gt;
I'm running with these arguments passed to the program, for debugging and properties file,&lt;/P&gt;

&lt;P&gt;-Djava.util.logging.config.file=C:\Explorer_Exports\jdklogging.properties  -Xdebug -Djavax.net.debug=all&lt;/P&gt;

&lt;P&gt;Was wondering if I'm using the proper .jar files in build path; classes from the .zip file, or my logger setup may be incorrect.&lt;/P&gt;

&lt;P&gt;Any assistance would be appreciated.  Steve.&lt;/P&gt;

&lt;P&gt;==  S O U R C E    C O D E ===========================================================================&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;//                                                               
package com.mycompany.logging;                               
import java.io.*;  
import java.util.logging.*;                                      
import com.splunk.logging.*;  
import com.splunk.logging.SplunkCimLogEvent; 
//      

public class LogTestSplunk{ 

  public static void main(String arg[]) throws IOException {   
  Logger logger = Logger.getLogger("splunklogger");
   SplunkCimLogEvent event = new SplunkCimLogEvent("zCEE", "PostInvokeSAK");
   //*************************************************************
   // Splunk Handler
   Handler shandler = new HttpEventCollectorLoggingHandler();
   logger.addHandler(shandler);
   // echo out properties here...
   //....
   // continue with logger code.
    event.setAuthApp("jane");                                             
    event.setAuthUser("jane");                                            
event.addField("message", "this is my test message foobar");
    logger.info(event.toString()); 
  }                                                                      
}                                                                             
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;== C O N S O L E     L O G ====================================================================&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Property - com.splunk.logging.HttpEventCollectorLoggingHandler.url:== &lt;A href="https://hecdevsplunk.aetna.com:8088/services/collector/event" target="test_blank"&gt;https://hecdevsplunk.aetna.com:8088/services/collector/event&lt;/A&gt;
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.level:== INFO
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.token:== adee79d5-774e-4cff-9596-d7e2a52b4f5f
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.source:== http:zOS_java
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.sourcetype:== httpevent 
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.messageFormat:== text
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.index:== webeng-websphere
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.disableCertificateValidation:== false
Property - com.splunk.logging.HttpEventCollectorLoggingHandler.retries_on_error:== 00001

--- all the SSL handshake here ---  final SSL trace entry is this:
done seeding SecureRandom
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Mar 2020 16:42:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Java-Logger-and-Splunk-Class-HttpEventCollectorLoggingHandler/m-p/486408#M195681</guid>
      <dc:creator>steveIMS</dc:creator>
      <dc:date>2020-03-05T16:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Java Logger and Splunk Class HttpEventCollectorLoggingHandler not working, forwarding to HEC + Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Java-Logger-and-Splunk-Class-HttpEventCollectorLoggingHandler/m-p/704268#M238661</link>
      <description>&lt;P&gt;Were you able to solve this? I am facing the same issue&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 12:05:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Java-Logger-and-Splunk-Class-HttpEventCollectorLoggingHandler/m-p/704268#M238661</guid>
      <dc:creator>esmeemarch</dc:creator>
      <dc:date>2024-11-13T12:05:00Z</dc:date>
    </item>
  </channel>
</rss>

