Package org.logevents.observers
Class TcpLogEventObserver
- java.lang.Object
-
- org.logevents.core.AbstractFilteredLogEventObserver
-
- org.logevents.observers.AbstractBatchingLogEventObserver
-
- org.logevents.observers.TcpLogEventObserver
-
- All Implemented Interfaces:
LogEventObserver
public class TcpLogEventObserver extends AbstractBatchingLogEventObserver
Writes LogEvents to a TCP address. To avoid exceptions and network slowness interrupting main process flow, this observer batches the message sending with the same mechanism asAbstractBatchingLogEventObserver. This class has been optimized for writing to an ELK installationSample configuration (used with Logstash)
observer.tcp=TcpLogEventObserver observer.tcp.address=example.com:8888 observer.tcp.formatter=JsonLogEventFormatter observer.tcp.formatter.excludedMdcKeys=test
-
-
Field Summary
-
Fields inherited from class org.logevents.observers.AbstractBatchingLogEventObserver
defaultBatcher, executor, scheduledExecutorService, shutdownHook
-
-
Constructor Summary
Constructors Constructor Description TcpLogEventObserver(String address, LogEventFormatter formatter)TcpLogEventObserver(Map<String,String> properties, String prefix)TcpLogEventObserver(Configuration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidprocessBatch(LogEventBatch batch)StringtoString()-
Methods inherited from class org.logevents.observers.AbstractBatchingLogEventObserver
configureBatching, configureMarkers, createBatcher, createMdcBatcher, createProcessor, doLogEvent, getBatcher, getBatcherFactory, getDefaultBatcher, getMarkerBatcher, processBatch
-
Methods inherited from class org.logevents.core.AbstractFilteredLogEventObserver
configureFilter, filteredOn, getCondition, getThreshold, isEnabled, logEvent, setCondition, setFilter, setThreshold, shouldLogEvent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.logevents.LogEventObserver
isEnabled, stream, toList
-
-
-
-
Constructor Detail
-
TcpLogEventObserver
public TcpLogEventObserver(String address, LogEventFormatter formatter)
-
TcpLogEventObserver
public TcpLogEventObserver(Configuration configuration)
-
-
Method Detail
-
processBatch
protected void processBatch(LogEventBatch batch)
- Specified by:
processBatchin classAbstractBatchingLogEventObserver
-
toString
public String toString()
- Overrides:
toStringin classAbstractBatchingLogEventObserver
-
-