이 문서는 Atlassian 제품 Access Log 설정을 위한 정보를 공유하기 위해 작성되었다.
해당 설정을 웹 화면에서 확인하기 위해 Access Log Addon을 활용할 있다.
적용 대상 Tomcat으로 시작되는 모든 제품
- Jira Service Desk
- Jira software
- Confluence
- Bitbucket
- Bamboo
- Crowd
변경 가능한 옵션
- %a - Remote IP address
- %A - Local IP address
- %b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent
- %B - Bytes sent, excluding HTTP headers
- %h - Remote host name (or IP address if
enableLookupsfor the connector is false) - %H - Request protocol
- %l - Remote logical username from identd (always returns '-')
- %m - Request method
- %p - Local port
- %q - Query string (prepended with a '?' if it exists, otherwise an empty string
- %r - First line of the request
- %s - HTTP status code of the response
- %S - User session ID
- %t - Date and time, in Common Log Format format
- %u - Remote user that was authenticated
- %U - Requested URL path
- %v - Local server name
- %D - Time taken to process the request, in millis
- %T - Time taken to process the request, in seconds
- %I - current Request thread name (can compare later with stacktraces)
변경 방법
server.xml에서 Valve className="org.apache.catalina.valves.AccessLogValve"에서 패턴(pattern) 수정
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">
<Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
<Manager pathname=""/>
<JarScanner scanManifest="false"/>
<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="120" />
</Context>
</Host>
<Valve className="org.apache.catalina.valves.AccessLogValve"
pattern="%a %{jira.request.id}r %{jira.request.username}r %t "%m %U%q %H" %s %b %D "%{Referer}i" "%{User-Agent}i" "%{jira.request.assession.id}r""/>
</Engine>
2 댓글
황희연 대표
2019-08-20<Valve className="org.apache.catalina.valves.AccessLogValve" requestAttributesEnabled="true" pattern="%a %{jira.request.id}r %{jira.request.username}r %t "%m %U%q %H" %s %b %D "%{Referer}i" "%{User-Agent}i" "%{jira.request.assession.id}r""/> <Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="x-forwarded-for" protocolHeader="x-forwarded-proto" /> <Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="x-forwarded-for" protocolHeader="x-forwarded-proto" />황희연 대표
2019-08-20SonarQube
# Access log is the list of all the HTTP requests received by server. If enabled, it is stored # in the file {sonar.path.logs}/access.log. This file follows the same rolling policy as other log file # (see sonar.log.rollingPolicy and sonar.log.maxFiles). sonar.web.accessLogs.enable=true # Format of access log. It is ignored if sonar.web.accessLogs.enable=false. Possible values are: # - "common" is the Common Log Format, shortcut to: %h %l %u %user %date "%r" %s %b # - "combined" is another format widely recognized, shortcut to: %h %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}" # - else a custom pattern. See http://logback.qos.ch/manual/layouts.html#AccessPatternLayout. # The login of authenticated user is not implemented with "%u" but with "%reqAttribute{LOGIN}" (since version 6.1). # The value displayed for anonymous users is "-". # The SonarQube's HTTP request ID can be added to the pattern with "%reqAttribute{ID}" (since version 6.2). # If SonarQube is behind a reverse proxy, then the following value allows to display the correct remote IP address: sonar.web.accessLogs.pattern=%i{X-Forwarded-For} %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}" "%reqAttribute{ID}" "%reqAttribute{LOGIN}"