Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is localhost access log in tomcat?

Tags:

tomcat

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?

like image 828
Anurag Sharma Avatar asked Dec 26 '13 12:12

Anurag Sharma


2 Answers

localhost access log in tomcat contains the information associated with a request i.e.:

  1. IP address
  2. Time
  3. Request method (GET or POST)
  4. The resource for which the request is coming.
like image 130
Anurag Sharma Avatar answered Sep 20 '22 03:09

Anurag Sharma


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

like image 30
Arafat Nalkhande Avatar answered Sep 20 '22 03:09

Arafat Nalkhande