Logstash + elasticsearch log rotation


Can someone help me with the configuration of logrotation in logstash and in elasticsearch? I am using v5 of elasticsearch.

My goal is to have a similar log rotation, like I have configured in filebeat (which is below)

-----------Filebeat cfg file-----------
# The name of the files where the logs are written to.
name: mybeat

# Configure log file size limit. If limit is reached, log file will be
# automatically rotated
rotateeverybytes: 10485760 # = 10MB

# Number of rotated log files to keep. Oldest files will be deleted first.
keepfiles: 7

my log4j2.properties file which I have configured with the following settings, but they dont see to be applied...

appender.rolling.type = RollingFile
appender.rolling.name = plain_rolling
appender.rolling.fileName = {sys:ls.logs}/logstash-{sys:ls.log.format}.log
appender.rolling.filePattern = {sys:ls.logs}/logstash-{sys:ls.log.format}-%d{yyyy-MM-dd}-%i.log.gz
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %-.10000m%n
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size = 10MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 2
appender.rolling.strategy.action.type = Delete
appender.rolling.strategy.action.basepath = {sys:ls.logs} appender.rolling.strategy.action.condition.type = IfFileName appender.rolling.strategy.action.condition.glob = logstash-{sys:ls.log.format}-*
appender.rolling.strategy.action.ifAny.type = IfAny
appender.rolling.strategy.action.ifAny.ifLastModified.type = IfLastModified
appender.rolling.strategy.action.ifAny.ifLastModified.age = 3D
appender.rolling.strategy.action.ifAny.ifAccumulatedFileSize.type = IfAccumulatedFileSize
appender.rolling.strategy.action.ifAny.ifAccumulatedFileSize.exceeds = 100MB

Thanks in advance.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.