You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -5,18 +5,18 @@ information such as the persons who access it, how many hits
5
5
it received, what the errors are, etc. This information is useful for
6
6
troubleshooting errors. WSO2 Identity Server can enable access logs for the
7
7
HTTP servlet transport. This servlet transport works on `9443`/`9763` ports,
8
-
and it receives admin/operation requests. Therefore, access logs for the
8
+
and it receives admin/operation requests. So, access logs for the
9
9
servlet transport is useful for analysing operational/admin-level access
10
10
details.
11
11
12
-
###Configuring access logs for the HTTP servlet transport
12
+
## Configuring access logs for the HTTP servlet transport
13
13
14
14
In the Identity Server 5.9.0 only the access log pattern is configurable.
15
15
16
-
1.Open the `<IS_HOME>/repository/conf/deployment.toml`
16
+
1. Open the `<IS_HOME>/repository/conf/deployment.toml`
17
17
file.
18
18
19
-
2.Add the following configuration.
19
+
2. Add the following configuration.
20
20
21
21
```toml
22
22
[http_access_log]
@@ -75,16 +75,98 @@ In the Identity Server 5.9.0 only the access log pattern is configurable.
75
75
</tbody>
76
76
</table>
77
77
78
-
3. Restart the server. According to the configurations, a log
78
+
3. Restart the server. According to the configurations, a log
79
79
file named
80
-
`http_access.{DATE}.log` is
81
-
created by default inside the `<IS_HOME>/repository/logs` directory. The
80
+
`http_access.{DATE}.log` is
81
+
created by default inside the `<IS_HOME>/repository/logs` directory. The
82
82
log is rotated on a daily basis.
83
83
84
+
## Routing access logs to the Log4j2 logger
85
+
86
+
By default, HTTP access logs write to a separate `http_access.log` file using the Tomcat Access Log Valve. WSO2 Identity Server also supports routing HTTP access logs through the Log4j2 logger, which gives you full control over where those logs go.
87
+
88
+
To enable Log4j2-based access logging, set `useLogger = true` in `<IS_HOME>/repository/conf/deployment.toml`:
89
+
90
+
```toml
91
+
[http_access_log]
92
+
useLogger = true
93
+
```
94
+
95
+
After enabling this, update `<IS_HOME>/repository/conf/log4j2.properties` to add the HTTP access log appender and logger.
96
+
97
+
### Route to a dedicated rolling log file
98
+
99
+
If you want to keep HTTP access logs in their own file, separate from other server logs, you can route them to a rolling log file that rotates on a schedule and rolls over when it reaches a configured size. To do so,
appender.HTTP_ACCESS.filter.threshold.level = INFO
137
+
```
138
+
139
+
### Route to standard output
140
+
141
+
In Kubernetes environments, logs are typically collected from standard output rather than files. To make HTTP access logs part of that flow, route them to the console alongside all other server logs. To do so,
You can define other logging patterns and targets for the `HTTP_ACCESS` logger using standard Log4j2 configuration. See the [Log4j2 documentation](https://logging.apache.org/log4j/2.x/manual/configuration.html) for available options.
165
+
84
166
### Customizing access logs by pattern
85
167
86
168
Given below are a few sample configurations for customizing the
87
-
`pattern` attribute:
169
+
`pattern` attribute:
88
170
89
171
#### Example 1: Logging request headers
90
172
@@ -98,14 +180,14 @@ The configuration is as follows:
98
180
This sample configuration logs the Content-type,
99
181
Accept and Accept-encoding headers of every request coming to the
100
182
server. For example, in the following example, we use the
101
-
`RequestInfoExample` to send the HTTP request:
183
+
`RequestInfoExample` to send the HTTP request:
102
184
103
185
```java
104
186
GET http://<IP>:<PORT>/example/servlets/servlet/RequestInfoExample?abc=xyz
105
187
```
106
188
107
189
The following log entry is recorded in the
108
-
`http_access.{DATE}.log` file.
190
+
`http_access.{DATE}.log` file.
109
191
110
192
```java
111
193
text/plain; charset=utf-8*/* gzip,deflate,sdch
@@ -120,9 +202,8 @@ The configuration is as follows:
Copy file name to clipboardExpand all lines: en/identity-server/7.0.0/docs/deploy/monitor/http-access-logging.md
+83-1Lines changed: 83 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,88 @@ To configure access logs for HTTP servlet transport:
58
58
59
59
3. Restart the server. According to the configurations, a log file named `http_access.{DATE}.log` is created by default inside the `<IS_HOME>/repository/logs` directory. The log is rotated daily.
60
60
61
+
## Routing access logs to the Log4j2 logger
62
+
63
+
By default, HTTP access logs write to a separate `http_access.log` file using the Tomcat Access Log Valve. WSO2 Identity Server also supports routing HTTP access logs through the Log4j2 logger, which gives you full control over where those logs go.
64
+
65
+
To enable Log4j2-based access logging, set `useLogger = true` in `<IS_HOME>/repository/conf/deployment.toml`:
66
+
67
+
```toml
68
+
[http_access_log]
69
+
useLogger = true
70
+
```
71
+
72
+
After enabling this, update `<IS_HOME>/repository/conf/log4j2.properties` to add the HTTP access log appender and logger.
73
+
74
+
### Route to a dedicated rolling log file
75
+
76
+
If you want to keep HTTP access logs in their own file, separate from other server logs, you can route them to a rolling log file that rotates on a schedule and rolls over when it reaches a configured size. To do so,
appender.HTTP_ACCESS.filter.threshold.level = INFO
114
+
```
115
+
116
+
### Route to standard output
117
+
118
+
In Kubernetes environments, logs are typically collected from standard output rather than files. To make HTTP access logs part of that flow, route them to the console alongside all other server logs. To do so,
You can define other logging patterns and targets for the `HTTP_ACCESS` logger using standard Log4j2 configuration. See the [Log4j2 documentation](https://logging.apache.org/log4j/2.x/manual/configuration.html) for available options.
142
+
61
143
### Customizing access logs by pattern
62
144
63
145
Given below are a few sample configurations for customizing the `pattern` attribute:
@@ -138,4 +220,4 @@ The above sample configuration logs the following:
0 commit comments