Package com.splunk.logging
Class HttpEventCollectorSender
java.lang.Object
java.util.TimerTask
com.splunk.logging.HttpEventCollectorSender
- All Implemented Interfaces:
HttpEventCollectorMiddleware.IHttpSender
,Runnable
public class HttpEventCollectorSender extends TimerTask implements HttpEventCollectorMiddleware.IHttpSender
This is an internal helper class that sends logging events to Splunk http event collector.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HttpEventCollectorSender.SendMode
Sender operation mode. -
Field Summary
Fields Modifier and Type Field Description static int
DefaultBatchCount
static int
DefaultBatchInterval
Recommended default values for events batching.static int
DefaultBatchSize
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
addMiddleware(HttpEventCollectorMiddleware.HttpSenderMiddleware middleware)
void
disableCertificateValidation()
Disable https certificate validation of the splunk server.void
flush()
Flush all pending eventsvoid
flush(boolean close)
void
postEvents(List<HttpEventCollectorEventInfo> events, HttpEventCollectorMiddleware.IHttpSenderCallback callback)
static void
putIfPresent(com.google.gson.JsonObject collection, String tag, Object value)
void
run()
Timer heartbeatvoid
send(String message)
Send a single logging event with message only in case of batching the event isn't sent immediatelyvoid
send(String severity, String message, String logger_name, String thread_name, Map<String,String> properties, String exception_message, Serializable marker)
Send a single logging event in case of batching the event isn't sent immediatelyvoid
setEventBodySerializer(EventBodySerializer eventBodySerializer)
-
Field Details
-
DefaultBatchInterval
public static final int DefaultBatchIntervalRecommended default values for events batching.- See Also:
- Constant Field Values
-
DefaultBatchSize
public static final int DefaultBatchSize- See Also:
- Constant Field Values
-
DefaultBatchCount
public static final int DefaultBatchCount- See Also:
- Constant Field Values
-
-
Constructor Details
-
HttpEventCollectorSender
public HttpEventCollectorSender(String Url, String token, String channel, String type, long delay, long maxEventsBatchCount, long maxEventsBatchSize, String sendModeStr, Map<String,String> metadata)Initialize HttpEventCollectorSender- Parameters:
Url
- http event collector input servertoken
- application tokendelay
- batching delaymaxEventsBatchCount
- max number of events in a batchmaxEventsBatchSize
- max size of batchmetadata
- events metadatachannel
- unique GUID for the client to send raw events to the servertype
- event data type
-
-
Method Details
-
addMiddleware
-
send
public void send(String severity, String message, String logger_name, String thread_name, Map<String,String> properties, String exception_message, Serializable marker)Send a single logging event in case of batching the event isn't sent immediately- Parameters:
severity
- event severity level (info, warning, etc.)message
- event text
-
send
Send a single logging event with message only in case of batching the event isn't sent immediately- Parameters:
message
- event text
-
flush
public void flush()Flush all pending events -
flush
public void flush(boolean close) -
run
public void run()Timer heartbeat -
disableCertificateValidation
public void disableCertificateValidation()Disable https certificate validation of the splunk server. This functionality is for development purpose only. -
setEventBodySerializer
-
putIfPresent
-
postEvents
public void postEvents(List<HttpEventCollectorEventInfo> events, HttpEventCollectorMiddleware.IHttpSenderCallback callback)- Specified by:
postEvents
in interfaceHttpEventCollectorMiddleware.IHttpSender
-