I want to know what is local host access log in tomcat ? what information we can monitor by these logs and how to read them through a Java program?
localhost access log
in tomcat contains the information associated with a request i.e.:
The access log contains the information for each request that hits the server. It can be used to track page hit counts, user session activity, and so on because it logs all the incoming requests along with Timestamp, Request HTTP Method and the HTTP Response code.
Sample log statements are as follows
46.181.252.151 - - [22/Feb/2019:19:04:19 +0000] "GET /task/768476366 HTTP/1.1" 200 6765
36.231.298.259 - - [22/Feb/2019:19:04:20 +0000] "GET /doc/wallet/9855563 HTTP/1.1" 200 45564
Common logging pattern ="%h %l %u %t "%r" %s %b"
%h – Remote hostname (or IP address if the resolveHosts attribute is set to false; by default the value is false).
%l – Remote logical user name; this is always a hyphen (-).
%u – Remote user that has been authenticated. In the example, “admin” and a hyphen (-). If there is none, it’s a hyphen (-).
%t – Date and time in common log file format.
%r – The first line of the request. In the example, “GET / HTTP/1.1” (note that this is configured to be shown within quotes (“”)).
%s – The HTTP status code of the response. In the example 200 is the OK status.
%b – Bytes sent count, excluding HTTP headers, and shows a hyphen (-) if zero.
For more details click here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With