Configure Bitbucket Server Logging

お困りですか?

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

コミュニティに質問

It is sometimes useful for Bitbucket Server administrators to change the number of days logs are kept or the size of those individual log files. These sorts of modifications can be accomplished by editing the logback.xml located in <Bitbucket Server Installation>/atlassian-bitbucket/WEB-INF/classes/logback.xml

Bitbucket Server holds on to atlassian-bitbucket.log for 31 days by default. Similarly, atlassian-bitbucket-access.log files are kept for 10 days and they are in addition rotated through the day in case they reach 25MB. Any of these can be modified in the same way for any of the logs listed in the logback.xml: by editing respectively the max_history variable and maxFileSize:

<Bitbucket Server Installation>/atlassian-bitbucket/WEB-INF/classes/logback.xml
<appender name="bitbucket.application" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<charset>UTF-8</charset>
<pattern>${log.format}</pattern>
</encoder>
<file>${log.dir}/atlassian-bitbucket.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.dir}/atlassian-bitbucket-%d.log</fileNamePattern>
<maxHistory>31</maxHistory>
</rollingPolicy>
</appender>

...
...
 
<appender name="bitbucket.accesslog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<charset>UTF-8</charset>
<pattern>${accesslog.format}</pattern>
</encoder>
<file>${log.dir}/atlassian-bitbucket-access.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.dir}/atlassian-bitbucket-access-%d.%i.log</fileNamePattern>
<maxHistory>10</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>25MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>

In case you wanted to gzip any of the logs automatically on their rotation, you could change the line above and add .gz as an extension:

<fileNamePattern>${log.dir}/atlassian-bitbucket-%d.log.gz</fileNamePattern>

または

<fileNamePattern>${log.dir}/atlassian-bitbucket-access-%d.%i.log.gz</fileNamePattern>

 

 

  • As these files are maintained in the <Bitbucket Server Installation> directory, these changes will need to be re-applied manually when Bitbucket Server is upgraded
  • A Bitbucket Server restart after changes have been made is mandatory.

 

 

最終更新日 2016 年 11 月 18 日

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

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