Enabling Access Logging in Fisheye

警告

The solution below is compatible with Fisheye versions from 4.7.x onwards which bundle Jetty library version 9.4.

Previous Fisheye versions bundle Jetty library version 8.1, in which the settings are incompatible. If you are using Fisheye versions up to 4.6.x, please go to Previous Versions section.

To enable access logging in Fisheye versions from 4.7.x onwards:

  1. Stop Fisheye/Crucible,
  2. Create the file <FishEye install directory>/content/WEB-INF/jetty-web.xml with the following content:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd" >
    <Configure class="org.eclipse.jetty.webapp.WebAppContext">
      <Call name="insertHandler">
        <Arg>
          <New id="RequestLog" class="com.cenqua.fisheye.web.jetty.FishEyeRequestLogHandler">
            <Set name="requestLog">
              <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
                <Set name="filename"><Property name="jetty.logs" default="PATH_LOG_FOLDER"/>/access-yyyy_mm_dd.log</Set>
                <Set name="filenameDateFormat">yyyy_MM_dd</Set>
                <Set name="LogTimeZone">GMT</Set>
                <Set name="retainDays">90</Set>
                <Set name="append">true</Set>
                <Set name="LogLatency">true</Set>
              </New>
            </Set>
          </New>
        </Arg>
      </Call>
    </Configure>
  3. Restart Fisheye/Crucible.

This will create an access log in <PATH_LOG_FOLDER>/var/log/fisheye-access-yyyy_mm_dd.log format (e.g. fisheye-access-2010_03_17.log). Note that it's necessary to replace the PATH_LOG_FOLDER value for the directory wanted to store Fisheye access logs.

The log directory must exist

If the path to the log directory given by the default attribute of the SystemProperty tag (defined in the line 10 in the jetty-web.xml above) does not exist, then Fisheye will fail to start and will not log any error message.

The path given in the example below is correct when FISHEYE_INST and the <FishEye install directory> are the same directory, otherwise please use the absolute path of your FISHEYE_INST/var/log directory.




Previous versions - To enable access logging in Fisheye versions between 3.0.x and 4.6.x:

  1. Stop Fisheye/Crucible,
  2. Create the file <FishEye install directory>/content/WEB-INF/jetty-web.xml with the following content:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd" >
    <Configure class="org.eclipse.jetty.webapp.WebAppContext">
      <Set name="handler">
        <New class="com.cenqua.fisheye.web.jetty.FishEyeRequestLogHandler">
          <Set name="requestLog">
            <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
              <Arg><SystemProperty name="jetty.logs" default="./var/log/" />fisheye-access-yyyy_mm_dd.log</Arg>
              <Set name="retainDays">90</Set>
              <Set name="append">true</Set>
              <Set name="extended">false</Set>
              <Set name="LogTimeZone">GMT</Set>
            </New>
          </Set>
        </New>
      </Set>
    </Configure>
  3. Restart Fisheye/Crucible.

This will create an access log in <FishEye install directory>/var/log/fisheye-access-yyyy_mm_dd.log format (e.g. fisheye-access-2010_03_17.log). If you want to change the path to your FISHEYE_INST directory, change the default="./var/log/" to the path to the log folder in FISHEYE_INST.

The log directory must exist

If the path to the log directory given by the default attribute of the SystemProperty tag (defined in the line 10 in the jetty-web.xml above) does not exist, then Fisheye will fail to start and will not log any error message.

The path given in the example below is correct when FISHEYE_INST and the <FishEye install directory> are the same directory, otherwise please use the absolute path of your FISHEYE_INST/var/log directory.

ログ形式

The logs are written in NCSA format:

172.20.5.186 -  -  [17/Mar/2010:22:50:21 +0000] "GET /fe/commitSparkline.do?w=280&h=48&context=repository&repname=TestRepo&outputtype=image HTTP/1.1" 200 256
172.20.5.186 -  -  [17/Mar/2010:22:50:21 +0000] "GET /fe/commitSparkline.do?w=280&h=48&context=repository&repname=npanday&outputtype=image HTTP/1.1" 200 177
172.20.5.186 -  -  [17/Mar/2010:22:50:21 +0000] "GET /fe/commitSparkline.do?w=280&h=48&context=repository&repname=jutils&outputtype=image HTTP/1.1" 200 775
172.20.5.186 -  -  [17/Mar/2010:22:50:21 +0000] "GET /fe/commitSparkline.do?w=280&h=48&context=repository&repname=P4&outputtype=image HTTP/1.1" 200 177
172.20.5.186 -  -  [17/Mar/2010:22:50:21 +0000] "GET /fe/commitSparkline.do?w=280&h=48&context=repository&repname=Rails&outputtype=image HTTP/1.1" 200 1311
172.20.5.186 -  -  [17/Mar/2010:22:50:22 +0000] "GET /fe/commitSparkline.do?w=280&h=48&context=repository&repname=FE-2363&outputtype=image HTTP/1.1" 200 128 

Please refer to the Jetty documentation for more configuration options.

Compatibility

If you are using an earlier version of Fisheye than Fisheye 2.7.8, replace com.cenqua.fisheye.web.jetty.FishEyeRequestLogHandler by org.mortbay.jetty.handler.RequestLogHandler.

FishEyeRequestLogHandler was added in 2.7.8 to fix an issue where the user credentials would not be added to the NCSA log: FE-3040.

As mentioned at the top, this solution works with Fisheye versions up to 4.6.x. More information can be found at  FE-7172 - Getting issue details... STATUS


最終更新日: 2020 年 2 月 10 日

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

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