方法一:
参考https://confluence.atlassian.com/confkb/how-to-enable-user-access-logging-182943.html
在confluence/WEB-INF/web.xml删除注释,并修改
<filter-mapping>
<filter-name>AccessLogFilter</filter-name>
<url-pattern>/display/*</url-pattern>
</filter-mapping>
为
<filter-mapping>
<filter-name>AccessLogFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
在confluence/WEB-INF/classes/log4j.properties中添加配置
log4j.appender.accesslog=org.apache.log4j.RollingFileAppender
log4j.appender.accesslog.Threshold=DEBUG
log4j.appender.accesslog.File=${catalina.home}/logs/atlassian-confluence-access.log
log4j.appender.accesslog.MaxFileSize=20480KB
log4j.appender.accesslog.MaxBackupIndex=5
log4j.appender.accesslog.layout=com.atlassian.confluence.util.PatternLayoutWithStackTrace
log4j.appender.accesslog.layout.ConversionPattern=%d %p [%t] [%c{4}] %M %m%n
取消注释并添加
log4j.category.com.atlassian.confluence.util.AccessLogFilter=INFO, accesslog
log4j.additivity.com.atlassian.confluence.util.AccessLogFilter=false
重启confluence
方法二:
https://confluence.atlassian.com/doc/configure-access-logs-1044780567.html
修改<install-directory>/conf/server.xml
添加
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" maxDays="30"
pattern="%t %{X-AUSERNAME}o %{X-Forwarded-For}i %I %h %r %s %Dms %b %{Referer}i %{User-Agent}i" prefix="conf_access_log" requestAttributesEnabled="true" rotatable="true" suffix=".log"/>
重启confluence
方法三:
打开confluence/logs/atlassian-confluence-security.log 失败用户IP访问记录
将日志与性能分析→com.atlassian.confluence.security.login.DefaultLoginManager→把info调为debug