Archiv verlassen und diese Seite im Standarddesign anzeigen : Apache, kompletten Request in LogFile schreiben
Hallo,
Gibt es eine Möglichkeit den kompletten http Request in das Apache Access Log zu schreiben?
Also wenn jemand im Browser eingibt:
"http://www.wurst.de/senf/ketchup.html"
Genau diese Zeile hätte ich gerne im LogFile.
Ich google schon den ganzen Morgen, habe bisher nichts gefunden.
Vielen Dank!
Grüße,
Andreas
Hast Du Dir schonmal das Apache access.log angesehen?
Da steht nur der Referrer und sonst nix.
ich möchte gerne die komplette URL der aufgerufenen seite haben.
ich hab auch in der Apache Doku nichts gefunden.
Gruß,
Andreas
Na klar, hab ich doch glatt verwechselt..
Original geschrieben von pcfreak85
ich hab auch in der Apache Doku nichts gefunden.
Dann schaue nocheinmal genau nach. TIP: http://httpd.apache.org/docs/logs.html#combined
Das ist verdammt nochmal der Referrer!
ich will nicht nur wie in der doku /apache_pb.gif sondern die komplette URL.
So, z.B. http://www.apache.org/pix/4/apache_pb.gif
Und genau das steht eben nicht in der Doku!
Gruß,
Andreas
Combined Log Format
Another commonly used format string is called the Combined Log Format. It can be used as follows.
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
CustomLog log/acces_log combined
This format is exactly the same as the Common Log Format, with the addition of two more fields. Each of the additional fields uses the percent-directive %{header}i, where header can be any HTTP request header. The access log under this format will look like:
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"
Und von welchem Server das kommt, wirst Du ja wohl wissen. Ansonsten mußt Du halt für jeden VirtualServer eine eigene access.log anlegen. Wenn Du das ganze über die ReWrite-Engine laufen läßt mußt Du sonst dort das LogFile einschalten.
Oder es so machen wie hier
http://httpd.apache.org/docs/logs.html#virtualhosts
For the access log, there is a very good compromise. By adding information on the virtual host to the log format string, it is possible to log all hosts to the same log, and later split the log into individual files. For example, consider the following directives.
LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost
CustomLog logs/access_log comonvhost
The %v is used to log the name of the virtual host that is serving the request. Then a program like split-logfile can be used to post-process the access log in order to split it into one file per virtual host.
Pingu
PS: Bedenke dass z.B. die Domain nicht zum HTTP Request gehört. Denn das was Du im Browser eingibst ist nicht der HTTP Request. Denn ein HTTP Request sieht folgender massen aus (kannst Du auch gerne mit telnet nachvollziehen):
ts@ts-mobile:~
09:49:28 - 501> telnet httpd.apache.org 80
Trying 209.237.227.195...
Connected to minotaur-2.apache.org.
Escape character is '^]'.
GET / HTTP/1.1
HOST: httpd.apache.org
Die zugehörige Antwort wäre:
HTTP/1.1 200 OK
Date: Thu, 19 Feb 2004 08:50:12 GMT
Server: Apache/2.0.48-dev (Unix)
Last-Modified: Thu, 01 Jan 2004 13:48:12 GMT
ETag: "e2ed65-2183-1b3e7f00"
Accept-Ranges: bytes
Content-Length: 8579
Content-Type: text/html; charset=ISO-8859-1
[DATA]
Original geschrieben von pcfreak85
Das ist verdammt nochmal der Referrer!
ich will nicht nur wie in der doku /apache_pb.gif sondern die komplette URL.
So, z.B. http://www.apache.org/pix/4/apache_pb.gif
Es steht alles in der Doku, z.B. kann man das sich sonst alles auch selber zusammen setzten:
LogFormat "http://%v%U%q" pcfreak85
Pingu
Powered by vBulletin® Version 4.2.5 Copyright ©2024 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.