<appender ...>
<!-- The FastJsonEncoder treats the log as JSON. -->
<encoder class="ch.qos.logback.more.appenders.encoder.FastJsonEncoder">
<pattern><![CDATA[{
"date": "%date{HH:mm:ss.SSS}",
"thread": "%thread",
"marker": "%marker",
"level": "%-5level",
"logger": "%logger",
"line": "%line",
"requestURI": "%X{req.requestURI}",
"message": "%msg"
}\n]]></pattern>
<!-- Remove redandant spaces and lines. -->
<compressSpace>true</compressSpace>
</encoder>
</appender>
<appender name="KINESIS_SYNC"
class="ch.qos.logback.more.appenders.KinesisStreamLogbackAppender">
<awsConfig>
<!-- [Optional] Place AwsCredentials.properties in class path. -->
<credentialFilePath>AwsCredentials.properties</credentialFilePath>
<region>ap-northeast-1</region>
</awsConfig>
<streamName>test-stream</streamName>
<shardCount>2</shardCount>
<!-- [Optional] Default RandomPartitionKey. You can create custom Partition key by implementing PartitionKey interface.
Tips: If you won't have multiple shard, you can use the partition key for performance.
ch.qos.logback.more.appenders.KinesisStreamLogbackAppender$SinglePartitionKey
-->
<partitionKey class="ch.qos.logback.more.appenders.KinesisStreamLogbackAppender$RandomPartitionKey" />
<!-- [Optional] Create the stream automatically. -->
<createStreamDestination>true</createStreamDestination>
<!-- The minimum interval millis for each Kinesis API call. -->
<emitInterval>100</emitInterval>
<encoder>
<pattern><![CDATA[[%thread] %-5level %logger{15}#%line %msg]]></pattern>
</encoder>
</appender>
<appender name="KINESIS" class="ch.qos.logback.classic.AsyncAppender">
<!-- Max queue size of logs which is waiting to be sent (When it reach to the max size, the log will be disappeared). -->
<queueSize>999</queueSize>
<!-- Never block when the queue becomes full. -->
<neverBlock>true</neverBlock>
<!-- The default maximum queue flush time allowed during appender stop.
If the worker takes longer than this time it will exit, discarding any remaining items in the queue.
10000 millis
-->
<maxFlushTime>100</maxFlushTime>
<appender-ref ref="KINESIS_SYNC" />
</appender>