Closed gulecroc closed 2 weeks ago
Finally I create the JSON format with the default encoder
:
<appender name="SECURITY_AUDIT_FILE_JSON" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${log.dir}/access-security-audit-json.log</File>
<encoder>
<pattern>{"datetime":"%d{yyyy-MM-dd'T'HH:mm:ss.SSS,UTC}Z","traceid":"%formattedCustomUberTraceId","userip":"%X{audit.performingUserIp}","user":"%X{audit.performingUser}","loggedprincipal":"%X{audit.loggedinPrincipal}","entityname":"%X{audit.entityName}","eventtype":"%X{audit.securityEventType}","event":"%X{audit.securityEvent}","datachanged":%X{audit.dataChanged}}%n</pattern>
</encoder>
<rollingPolicy class="org.jfrog.common.logging.logback.rolling.FixedWindowWithDateRollingPolicy">
<FileNamePattern>${log.dir.archived}/access-security-audit-json.%i.log.gz</FileNamePattern>
<compressLatest>false</compressLatest>
</rollingPolicy>
<triggeringPolicy class="org.jfrog.common.logging.logback.triggering.SizeAndIntervalTriggeringPolicy">
<MaxFileSize>25MB</MaxFileSize>
</triggeringPolicy>
</appender>
But I think we could have a better solution with SecurityAuditJsonLayout
.
Hello,
I would like to collect the audit log in JSON format.
I override the logback.xml file for access component :
copy the
SECURITY_AUDIT
appender and set theSecurityAuditJsonLayout
layout used bySECURITY_AUDIT_CONSOLE_JSON
appender :add the appender to the logger :
Update the chart values :
The log output :
The problem is with the field
datachanged
that is already in JSON format before serialization.Do you have any solution ?
Thank you.
Guillaume