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.static class
HttpEventCollectorSender.TimeoutSettings
-
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
Constructors Constructor Description HttpEventCollectorSender(String Url, String token, String channel, String type, long delay, long maxEventsBatchCount, long maxEventsBatchSize, String sendModeStr, Map<String,String> metadata, HttpEventCollectorSender.TimeoutSettings timeoutSettings)
Initialize HttpEventCollectorSender
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods 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(long timeMsSinceEpoch, 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
send(String message)
Send a single logging event with message only in case of batching the event isn't sent immediatelyvoid
setEventBodySerializer(EventBodySerializer eventBodySerializer)
void
setEventHeaderSerializer(EventHeaderSerializer eventHeaderSerializer)
-
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
-
-
-
Field Detail
-
DefaultBatchInterval
public static final int DefaultBatchInterval
Recommended 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 Detail
-
HttpEventCollectorSender
public HttpEventCollectorSender(String Url, String token, String channel, String type, long delay, long maxEventsBatchCount, long maxEventsBatchSize, String sendModeStr, Map<String,String> metadata, HttpEventCollectorSender.TimeoutSettings timeoutSettings)
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 Detail
-
addMiddleware
public void addMiddleware(HttpEventCollectorMiddleware.HttpSenderMiddleware middleware)
-
send
public void send(long timeMsSinceEpoch, 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
public void send(String message)
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
public void setEventBodySerializer(EventBodySerializer eventBodySerializer)
-
setEventHeaderSerializer
public void setEventHeaderSerializer(EventHeaderSerializer eventHeaderSerializer)
-
putIfPresent
public static void putIfPresent(com.google.gson.JsonObject collection, String tag, Object value)
-
postEvents
public void postEvents(List<HttpEventCollectorEventInfo> events, HttpEventCollectorMiddleware.IHttpSenderCallback callback)
- Specified by:
postEvents
in interfaceHttpEventCollectorMiddleware.IHttpSender
-
-