public class SNSAppender<LogbackEventType> extends AbstractAppender<SNSWriterConfig,SNSWriterStatistics,SNSWriterStatisticsMXBean,LogbackEventType>
This appender supports the following configuration parameters:
| topicName | The name of the destination SNS topic; substitutions are allowed.
Must refer to a topic in the current region; if not, and you do not enable auto-create, initialization fails.
If you specify both |
|---|---|
| topicArn | The ARN of the destination SNS topic; substitutions are allowed.
Must refer to a topic in the current region; if not, initialization fails.
If you specify both |
| autoCreate | If true, and the topic is specified by name, the appender will create
the topic if it does not already exist. If false, a missing topic
will be reported as an error and the appender will be disabled.
Default is |
| subject | (optional) The subject for messages that are delivered via email. This is constrained by the SNS API to be less than 100 characters, ASCII only, and not start with whitespace. |
| truncateOversizeMessages | If true (the default), oversize messages are truncated to
the maximum length permitted by SNS. If false, they are
discarded. In either case, the oversized message is reported to the
Logback 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.
Note that the region must be supported by the current SDK version. |
| clientEndpoint | Specifies a non-default service endpoint. This is intended for use with older AWS SDK versions that do not provide client factories and default to us-east-1 for constructed clients, although it can be used for newer releases when you want to override the default region provider. This setting is ignored if you use a client factory. |
| useShutdownHook | Controls whether the appender uses a shutdown hook to attempt to process outstanding messages when the JVM exits. This is true by default; set to false to disable. |
appenderStats, assumedRole, batchDelay, clientEndpoint, clientFactory, clientRegion, discardAction, discardThreshold, internalLogger, lastRotationTimestamp, layout, messagesSinceLastRotation, rotationInterval, rotationMode, sequence, synchronous, threadFactory, truncateOversizeMessages, useShutdownHook, writer, writerFactory| Constructor and Description |
|---|
SNSAppender() |
| Modifier and Type | Method and Description |
|---|---|
protected SNSWriterConfig |
generateWriterConfig()
Called just before a writer is created, so that the subclass can
perform substitutions on the configuration.
|
boolean |
getAutoCreate()
Returns the
autoCreate configuration property. |
String |
getSubject()
Returns the
subject configuration property. |
String |
getTopicArn()
Returns the
topicArn configuration property, null
if the appender was configured via name. |
String |
getTopicName()
Returns the
topicName configuration property, null
if the appender was configured via ARN. |
void |
setAutoCreate(boolean value)
Sets the
autoCreate configuration property. |
void |
setBatchDelay(long value)
Any configured batch delay will be ignored; the appender attempts to send
all messages as soon as they are appended.
|
void |
setSubject(String value)
Sets the
subject configuration property. |
void |
setTopicArn(String value)
Sets the
topicArn configuration property. |
void |
setTopicName(String value)
Sets the
topicName configuration property. |
protected boolean |
shouldRotate(long now)
Determines whether the appender should rotate its writer.
|
append, getAppenderStatistics, getAssumedRole, getBatchDelay, getClientEndpoint, getClientFactory, getClientRegion, getDiscardAction, getDiscardThreshold, getRotationInterval, getRotationMode, getSequence, getSynchronous, getTruncateOversizeMessages, getUseShutdownHook, registerStatisticsBean, rotate, setAssumedRole, setClientEndpoint, setClientFactory, setClientRegion, setDiscardAction, setDiscardThreshold, setLayout, setName, setRotationInterval, setRotationMode, setSequence, setSynchronous, setTruncateOversizeMessages, setUseShutdownHook, start, stop, unregisterStatisticsBeanaddFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, toStringaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextpublic void setTopicName(String value)
topicName configuration property.public String getTopicName()
topicName configuration property, null
if the appender was configured via ARN.public void setTopicArn(String value)
topicArn configuration property.public String getTopicArn()
topicArn configuration property, null
if the appender was configured via name.public void setAutoCreate(boolean value)
autoCreate configuration property.public boolean getAutoCreate()
autoCreate configuration property.public void setSubject(String value)
subject configuration property.public String getSubject()
subject configuration property.public void setBatchDelay(long value)
setBatchDelay in class AbstractAppender<SNSWriterConfig,SNSWriterStatistics,SNSWriterStatisticsMXBean,LogbackEventType>protected SNSWriterConfig generateWriterConfig()
AbstractAppendergenerateWriterConfig in class AbstractAppender<SNSWriterConfig,SNSWriterStatistics,SNSWriterStatisticsMXBean,LogbackEventType>protected boolean shouldRotate(long now)
AbstractAppendershouldRotate in class AbstractAppender<SNSWriterConfig,SNSWriterStatistics,SNSWriterStatisticsMXBean,LogbackEventType>Copyright © 2020. All rights reserved.