Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log Rotation for http_access logs #3091

Closed
chethan1999 opened this issue Sep 3, 2024 · 1 comment
Closed

Log Rotation for http_access logs #3091

chethan1999 opened this issue Sep 3, 2024 · 1 comment

Comments

@chethan1999
Copy link

Description

Description

Our team is looking to apply log rotation configuration for our WSO2 stack in Production. We would like to limit the size of the files and the quantity based on time. We have applied these configurations for the wso2carbon and the audit logs, I pasted the log4j configs below for reference.
I'd like to request some assistance in getting the log rotation configurations for the http_access logs. I followed the documentation detailed here , but it created a new http_access file independent of the one that already exists.

[log4j-configs]
# CARBON_LOGFILE is set to be a DailyRollingFileAppender using a PatternLayout.
appender.CARBON_LOGFILE.type = RollingFile
appender.CARBON_LOGFILE.name = CARBON_LOGFILE
appender.CARBON_LOGFILE.fileName = /repository/logs/wso2carbon.log
appender.CARBON_LOGFILE.filePattern = /repository/logs/wso2carbon-%d{MM-dd-yyyy}.log
appender.CARBON_LOGFILE.layout.type = PatternLayout
appender.CARBON_LOGFILE.layout.pattern =[%d] %5p {%c} - [%X{dd.trace_id},%X{dd.span_id}]:%m%ex%n
appender.CARBON_LOGFILE.policies.type = Policies
appender.CARBON_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy
appender.CARBON_LOGFILE.policies.time.interval = 1
appender.CARBON_LOGFILE.policies.time.modulate = true
appender.CARBON_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy
appender.CARBON_LOGFILE.policies.size.size=10000MB
appender.CARBON_LOGFILE.strategy.type = DefaultRolloverStrategy
appender.CARBON_LOGFILE.strategy.max = 10
appender.CARBON_LOGFILE.strategy.action.type = Delete
appender.CARBON_LOGFILE.strategy.action.basepath = /repository/logs/
appender.CARBON_LOGFILE.strategy.action.maxdepth = 1
appender.CARBON_LOGFILE.strategy.action.condition.type = IfLastModified
appender.CARBON_LOGFILE.strategy.action.condition.age = 5D
appender.CARBON_LOGFILE.strategy.action.PathConditions.type = IfFileName
appender.CARBON_LOGFILE.strategy.action.PathConditions.glob = wso2carbon-*
appender.CARBON_LOGFILE.filter.threshold.type = ThresholdFilter
appender.CARBON_LOGFILE.filter.threshold.level = DEBUG
# Appender config to AUDIT_LOGFILE
appender.AUDIT_LOGFILE.type = RollingFile
appender.AUDIT_LOGFILE.name = AUDIT_LOGFILE
appender.AUDIT_LOGFILE.fileName = /repository/logs/audit.log
appender.AUDIT_LOGFILE.filePattern = /repository/logs/audit-%d{MM-dd-yyyy}.log
appender.AUDIT_LOGFILE.layout.type = PatternLayout
appender.AUDIT_LOGFILE.layout.pattern = [%d] %5p {%c} - [%X{dd.trace_id},%X{dd.span_id}]:%m%ex%n
appender.AUDIT_LOGFILE.policies.type = Policies
appender.AUDIT_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy
appender.AUDIT_LOGFILE.policies.time.interval = 1
appender.AUDIT_LOGFILE.policies.time.modulate = true
appender.AUDIT_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy
appender.AUDIT_LOGFILE.policies.size.size=10MB
appender.AUDIT_LOGFILE.strategy.type = DefaultRolloverStrategy
appender.AUDIT_LOGFILE.strategy.max = 10
appender.AUDIT_LOGFILE.filter.threshold.type = ThresholdFilter
appender.AUDIT_LOGFILE.filter.threshold.level = INFO

Regards,
Chethan

Steps to Reproduce

Add the similar configuration referring to above for http_access log file.

Affected Component

APIM

Version

apim-3.2.0

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

No response

@npamudika
Copy link

Public branch fix is already added via wso2/wso2-synapse#2128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants