@Plugin(name="KinesisAppender",
category="Core",
elementType="appender")
public class KinesisAppender
extends AbstractAppender<KinesisWriterConfig,KinesisAppenderConfig,KinesisWriterStatistics,KinesisWriterStatisticsMXBean>
This appender supports the following configuration parameters:
| streamName | The name of the Kinesis data stream where messages are written. |
|---|---|
| partitionKey | The partition key to use for messages from this appender. All
messages with the same partition key will be sent to the same
Kinesis shard.
Default value is "{startupTimestamp}".
The value |
| autoCreate | If true, the appender will create the stream if it does not already
exist. If false, a missing stream will be reported as an error and
the appender will be disabled.
Default is |
| shardCount | For auto-created streams, the number of shards in the stream. |
| retentionPeriod | For auto-created streams, the number of hours that messages will be retained in the stream. Allowed range is 25 to 168. |
| batchDelay | The time, in milliseconds, that the writer will wait to accumulate
messages for a batch.
The writer attempts to gather multiple logging messages into a batch, to reduce communication with the service. The batch delay controls the time that a message will remain in-memory while the writer builds this batch. In a low-volume environment it will be the main determinant of when the batch is sent; in a high volume environment it's likely that the maximum request size will be reached before the delay elapses. The default value is 2000, which is rather arbitrarily chosen. If the appender is in synchronous mode, this setting is ignored. |
| truncateOversizeMessages | If true (the default), oversize messages are truncated to
the maximum length permitted by Kinesis. If false they are
discarded. In either case, the oversized message is reported to the
Log4J debug log.
|
| discardThreshold | The number of unsent messages that will trigger message discard. A
high value is useful when network connectivity is intermittent and/or
overall AWS communication is causing throttling. However, a value that
is too high may cause out-of-memory errors.
The default, 10,000, is based on the assumptions that (1) each message will be 1k or less, and (2) any app that uses remote logging can afford 10MB. |
| discardAction | The action to take when the number of unsent messages exceeds the
discard threshold. Values are "none" (retain all messages), "oldest"
(discard oldest messages), and "newest" (discard most recent messages).
The default is "oldest". Attempting to set an incorrect value will throw a configuration error. |
| assumedRole | Specifies role name or ARN that will be assumed by this appender. Useful for cross-account logging. If the appender does not have permission to assume this role, initialization will fail. |
| clientFactory | The fully-qualified name of a static method to create the correct AWS
client, which will be called instead of the writer's internal client
factory. This is useful if you need non-default configuration, such as
using a proxy server.
The passed string is of the form |
| clientRegion | Specifies a non-default service region. This setting is ignored if you use a client factory. |
| clientEndpoint | Specifies a non-default service endpoint. Typically used when running in a VPC, when the normal endpoint is not available. |
| initializationTimeout | Milliseconds to wait for appender to initialize. If this timeout expires, the appender will shut down its writer thread and discard any future log events. The only reason to change this is if you're deploying to a high- contention environment (and even then, the default of 60 seconds should be more than enough). |
| useShutdownHook | This exists for consistency with other appenders but ignored; Log4J2 provides its own shutdown hooks. |
| Modifier and Type | Class and Description |
|---|---|
static class |
KinesisAppender.KinesisAppenderBuilder |
appenderConfig, appenderStats, discardAction, internalLogger, layoutCharset, threadFactory, writer, writerFactory| Modifier | Constructor and Description |
|---|---|
protected |
KinesisAppender(String name,
KinesisAppenderConfig config,
InternalLogger internalLogger) |
| Modifier and Type | Method and Description |
|---|---|
protected KinesisWriterConfig |
generateWriterConfig()
Called as part of initialization.
|
static KinesisAppender.KinesisAppenderBuilder |
newBuilder() |
append, getAppenderStatistics, getConfig, registerStatisticsBean, start, stop, stop, unregisterStatisticsBeanerror, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toStringaddFilter, getFilter, hasFilter, isFiltered, removeFilter, stopequalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stopprotected KinesisAppender(String name, KinesisAppenderConfig config, InternalLogger internalLogger)
@PluginBuilderFactory public static KinesisAppender.KinesisAppenderBuilder newBuilder()
protected KinesisWriterConfig generateWriterConfig()
AbstractAppenderCopyright © 2022. All rights reserved.