How to configure the log rotation in Confluence access logs

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

    

要約

As explained in the Configure access logs document, Confluence is able to write access logs by using the Tomcat feature. However, by default, it rotates the files on daily basis using the below access log valve:

<Valve className="org.apache.catalina.valves.AccessLogValve"
       directory="logs"
       maxDays="30"
       pattern="%t %{X-AUSERNAME}o %I %h %r %s %Dms %b %{Referer}i %{User-Agent}i"
       prefix="conf_access_log"
       fileDateFormat="yyyy-MM-dd"
       requestAttributesEnabled="true"
       rotatable="true"
       suffix=".log"
       />

環境

Confluence 7.13 or later version. 

ソリューション

To rotate the files more often, the fileDateFormat should be changed. This will allow Confluence to rotate the files depending on your own preferences.

As an example, the access log valves show the configuration for rotating the logs every hour or every minute: 

Rotate the log file every hour
<Valve className="org.apache.catalina.valves.AccessLogValve"
       directory="logs"
       maxDays="30"
       pattern="%t %{X-AUSERNAME}o %I %h %r %s %Dms %b %{Referer}i %{User-Agent}i"
       prefix="conf_access_log"
       fileDateFormat="yyyy-MM-dd.HH"
       requestAttributesEnabled="true"
       rotatable="true"
       suffix=".log"
       />
Rotate the log file every minute
<Valve className="org.apache.catalina.valves.AccessLogValve"
       directory="logs"
       maxDays="30"
       pattern="%t %{X-AUSERNAME}o %I %h %r %s %Dms %b %{Referer}i %{User-Agent}i"
       prefix="conf_access_log"
       fileDateFormat="yyyy-MM-dd.HH.mm"
       requestAttributesEnabled="true"
       rotatable="true"
       suffix=".log"
       />


最終更新日: 2023 年 10 月 12 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.