favicon error_log

Apache, Lighttpd, nginx, Cherokee
hasch
Posts: 99
Joined: 2007-03-09 15:23
 

favicon error_log

Post by hasch »

Gibt es eine Möglichkeit im Apache Error_log, dass favicon.ico automatisch ignoriert wird, weil es füllt das Logfile "umsonst" :)
rootsvr
Posts: 538
Joined: 2005-09-02 11:12
 

Re: favicon error_log

Post by rootsvr »

Erzeug Dir halt nen Favicon?
hasch
Posts: 99
Joined: 2007-03-09 15:23
 

Re: favicon error_log

Post by hasch »

Nunja, gibts denn keine andere Möglichkeit?
User avatar
daemotron
Administrator
Administrator
Posts: 2641
Joined: 2004-01-21 17:44
 

Re: favicon error_log

Post by daemotron »

Nicht wirklich - neuere Browser fordern es per GET /favicon.ico an, und der Webserver kann diesen GET nicht von einem anderen unterscheiden. Ergo hast Du zwei Möglichkeiten:
  • Du erzeugst eine Datei mit Namen favicon.ico - ob sie wirklich ein Icon enthält, ist eigentlich völlig wurscht. Damit taucht der GET aber dann im Access Log auf... los bist Du ihn immer noch nicht.
  • Du schmeißt Zeilen bezüglich Favicon einfach aus dem Logfile raus:

    Code: Select all

    sed -i '/favicon/d' /pfad/zur/logdatei
User avatar
Joe User
Project Manager
Project Manager
Posts: 11185
Joined: 2003-02-27 01:00
Location: Hamburg
 

Re: favicon error_log

Post by Joe User »

<mode nitpick=on">

Code: Select all

sed '/favicon/d' -i /pfad/zur/logdatei
</mode>
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Anonymous
 

Re: favicon error_log

Post by Anonymous »

Für das Access.log habe ich mir so geholfen.

Code: Select all

CustomLog /home/vhost/www.deine-domain/log/access.log combined env=!dontlog

SetEnvIf Request_URI "^/favicon.ico$" dontlog
hasch
Posts: 99
Joined: 2007-03-09 15:23
 

Re: favicon error_log

Post by hasch »

Danke für deinen Post, fürs Access_log passt das ja wunderbar, leider kann man beim Error_log ja keine solche Bedingung angeben, deshalb wird mir wohl nichts weiter übrig bleiben, als die Ausgaben an ein externes Skript weiterzuleiten und mit Hilfe von jfreund's Code zu filtern, danke :)
ren
Posts: 18
Joined: 2006-01-04 11:58
Location: Karlsruhe
 

Re: favicon error_log

Post by ren »

Hier der Inhalt der Konfiguration, die ich in allen VHosts include:

Code: Select all

# Send an 404, if favicon.ico is not available
Redirect 404 /favicon.ico
<location /favicon.ico>
        ErrorDocument 404 "No favicon.ico available"
</location>
OT: Hiermit habe ich meinen Plaintext-Traffic um 60% reduziert :-D

Code: Select all

# deflate
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
flo
Posts: 2223
Joined: 2002-07-28 13:02
Location: Berlin
 

Re: favicon error_log

Post by flo »

Brechstange:

Code: Select all

echo ""> favicon.ico
User avatar
Joe User
Project Manager
Project Manager
Posts: 11185
Joined: 2003-02-27 01:00
Location: Hamburg
 

Re: favicon error_log

Post by Joe User »

Code: Select all

touch favicon.ico
8)
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
flo
Posts: 2223
Joined: 2002-07-28 13:02
Location: Berlin
 

Re: favicon error_log

Post by flo »

Träger des useless-use-of-cat-award benutzen "echo" ... :-P
captaincrunch
Userprojekt
Userprojekt
Posts: 7066
Joined: 2002-10-09 14:30
Location: Dorsten
 

Re: favicon error_log

Post by captaincrunch »

Warum einfach, wenn's auch kompliziert geht? ;)

Code: Select all

>favicon.ico
DebianHowTo
echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc
ren
Posts: 18
Joined: 2006-01-04 11:58
Location: Karlsruhe
 

Re: favicon error_log

Post by ren »

Um es nochmal zusammenzufassen: Wer nicht in jedes DocumentRoot hampeln will und dort eine dummy favicon Datei anlegen, kann die Sache auch "sauber" lösen. Dies verhindert ausserdem, dass Apache bei jedem Besucher unnötig ins Filesystem greifen muss. (Ja, ich weiß, FS Cache)

Hierzu Folgendes in die von jedem VHost eingebundene Konfiguration oder gleich in die Hauptkonfiguration:

Code: Select all

Redirect 404 /favicon.ico
<location /favicon.ico>
        ErrorDocument 404 "No favicon.ico available"
</location>
SetEnvIf Request_URI "^/favicon.ico$" dontlog
Dann noch bei jedem VHost die CustomLog Direktive ergänzen:

Code: Select all

find /etc/apache2/sites-available -type f -exec sed 's/access.log combined$/access.log combined env=!dontlog/g' -i {} ;
(Das Verzeichnis für die VHost Files entsprechend anpassen)
flo
Posts: 2223
Joined: 2002-07-28 13:02
Location: Berlin
 

Re: favicon error_log

Post by flo »

Ich finde es etwas sinnbefreit, per location-handler einen umfangreicheren Fehler auszugeben als eh schon passiert.

Die Nolog-Geschichte ist sinnvoll, wenn man von vornherein auf favicons verzichtet - keine Frage. Aber analog gilt das auch für die robots.txt.

flo.
User avatar
Joe User
Project Manager
Project Manager
Posts: 11185
Joined: 2003-02-27 01:00
Location: Hamburg
 

Re: favicon error_log

Post by Joe User »

flo wrote:Ich finde es etwas sinnbefreit, per location-handler einen umfangreicheren Fehler auszugeben als eh schon passiert.
Es ist Sinnbefreit! Es ist doch kein Problem ein Default-Favicon per Oneliner in den Docroot der vHosts zu kopieren...
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
flo
Posts: 2223
Joined: 2002-07-28 13:02
Location: Berlin
 

Re: favicon error_log

Post by flo »

Du meinst, so daß der Kunde die Datei einfach überschreiben kann und nicht stundenlang rumrätselt, warum das favicon nicht angezeigt wird? ;-)
ren
Posts: 18
Joined: 2006-01-04 11:58
Location: Karlsruhe
 

Re: favicon error_log

Post by ren »

Der OP will verhindern, dass favicon Requests in error- und accesslog auftauchen.
Das Erstellen einer dummy favicon Datei ist somit nur die halbe Lösung.