Il peut être parfois utile de ne pas logger certains scripts dans les access log d'Apache, histoire de ne pas faire gonfler ces derniers trop vite, ou tout simplement parce que ces logs ne nous sont d'aucune utilité.
Je prends par exemple le cas d'un script ajax qui va appeler régulièrement une page (dans le cadre d'un système de notifications, de shoutbox, etc.). S'il y a beaucoup de monde connecté sur le site en même temps, même s'ils sont inactifs, les access logs vont se remplir.
L'idée est donc de dire à Apache de ne pas logger les appels à tel ou tel script (ou à l'inverse de le faire uniquement pour ceux-ci).
Pour ce faire, nous allons utiliser la directive SetEnvIf du module mod_setenvif d'Apache, ansi que la directive CustomLog.
Son utilisation est relativement simple. Il vous suffit d'éditer votre fichier vhost ou de configuration, et de placer la directive comme suit, avant toute déclaration d'un CustomLog :
SetEnvIf Request_URI "my_page.php$" donotlog
Cette ligne permet de définir une variable d'environnement en fonction de la requête.
Dans notre cas, on dit à Apache de créer la variable "donotlog" dans le cas où l'URL appelée est "my_page.php".
C'est cette variable qui va nous permettre de logger ou non l'appel.
Et pour ça, il suffit d'ajouter un 3 ème argument à la directive CustomLog : une variable d'environnement à tester.
SetEnvIf Request_URI "my_page.php$" donotlog CustomLog /dev/null env=donotlog // on jette à la poubelle tous les logs d'appels CustomLog /var/log/apache2/access_atelier_dev.log combined env=!donotlog // on garde tous les appels où "donotlog" n'est pas défini
Évidement, vous n'êtes pas limité à une seule condition, vous pouvez mettre plusieurs SetEnvIf à la suite et vous pouvez aussi en faire l'usage inverse (= ne logger que les appels à certaines pages).
P-S. : n'oubliez pas de redémarrer Apache pour que les modifications prennent effet !
Commentaires :
# google, le lundi 25 janvier 2021 à 03:10:20 # apartments on lease in magnolias, le vendredi 23 avril 2021 à 02:16:18learnd
cheap
Pour ne pas être amer parce que je reçois malade de cette
awesome job
I'm overjoyed to have discovered your article and look forward to spending several more enjoyable hours browsing it. Once again, thank you for all of the details.
It is vital to obtain feedback on the server's activity and performance, as well as any problems that may arise, in order to efficiently administer a web server. The logging features of the Apache HTTP Server are extensive and configurable. This guide explains how to configure its logging capabilities as well as how to decipher the contents of the logs.
Anyone who visits TikoFoundation will not be disappointed. This is a great website for those who value their time. All you need to do is visit the main page.
I should discover it earlier
Great post
Great post, thank you for this informative content!
this is good information. Very informative
very well said
Great! Thanks for reminding us
focused
great
amazing
such a wonderful pots
thanks
great post
Very interesting information! Perfect just what I was searching for
great post.
nice post.
nice post.
Thank you for sharing. This is amazing!
The matter and content are amazing. Thank you for sharing. All the best!
What a wonderful post.
This is amazing. Thank you!
This is awesome.
The matter and content are amazing. Thank you for sharing. All the best from our <a href="https://seniormarketadvisors.com/">fmo insurance companies</a>
step into the realm of Solos Construction - the epitome of expertise in the realm of stucco and scaffolding nestled amidst the dynamic expanse of Southern California
For all your home improvement and landscape needs in Dartford, Kent, and the surrounding areas, Dartford Construction & Landscaping
Discover the perfect venue solution with Marquee Hire HST. Explore our range of high-quality marquees for hire from weddings to corporate events. Your ideal event space is waiting for you. Contact us today 01424237969 and let's make your party less hassle!
At Orca Marketing, we offer comprehensive digital solutions tailored to elevate your online presence
Transforming spaces with Okie Concrete. Explore our premium concrete services for residential and commercial projects. From driveways to foundations, trust us for durable, expert craftsmanship
Expert pet waste removal in OKC! WeScoopThePoopOKC.com offers hassle-free solutions for cleaner outdoor spaces. Tailored services, client-focused, and pet-friendly expertise. Schedule today! Contact us and request a quote here: https://wescoopthepoopokc.com/
As the UK?s FIRST and ONLY Security Industry Membership based Insurance Company, we are committed to protecting the health, wealth and confidence of licensed security staff across the UK
I am loving this site.
I love it.
Thank you for this informationhttps://getprintedbox.com/portfolio/custom-mailer-boxes/">custom mailer boxes o
I love this blog. I don't know what I'd do without you and your great info! Thank you so much!
I love this blog. I don't know what I'd do without you and your great info! Thank you so much!
Excellent content
This is awesome. Thank you!
Market4Numbers: Your Ultimate Solution for SMS Verification!<
Looking for a reliable and secure way to receive SMS verification codes? Look no further! Visit https://market4numbers.com Market4Numbers or http://market4numbers.com Market4Numbers and https://market4numbers.com/freenumbers FreeNumbers or http://market4numbers.com/freenumbers FreeNumbers today!
We offer flexible and affordable virtual numbers to meet all your online verification needs. Join the many satisfied customers who trust us for seamless account activations. Don't miss out - check us out at:
https://market4numbers.com Market4Numbers
https://market4numbers.com/freenumbers FreeNumbers
https://market4numbers.com Market4Numbers
https://market4numbers.com/freenumbers FreeNumbers
https://market4numbers.com Market4Numbers
https://market4numbers.com/freenumbers FreeNumbers
At https://market4numbers.com Market4Numbers and https://market4numbers.com/freenumbers FreeNumbers , we understand the importance of privacy and security. Our virtual numbers provide a safe way to verify your accounts without revealing your personal phone number. Whether you're signing up for a new service, creating multiple accounts, or simply protecting your privacy, our virtual numbers are the perfect solution.
devliberty Small Business Website https://www.devliberty.net/projects/en Elevate your website's visibility with our https://www.devliberty.net/seo/en one-month SEO service package.
https://www.devliberty.net/seo/en 6 Months SEO service package https://www.devliberty.net/seo/en 1 Year SEO service package. https://www.devliberty.net/about/en Small Website
Medium site https://www.devliberty.net/projects/en Large site https://www.devliberty.net/projects/en .
Bienvenue chez DevLiberty, votre agence web https://www.devliberty.net/home/fr spécialisée dans la https://www.devliberty.net/home/fr création de site internet et le marketing digital.En tant qu'agence de marketing digital, nous offrons des solutions adaptées à tous vos besoins, qu'il s'agisse de site vitrine ou de commerce électronique.Nos services incluent :Création de site web professionnel https://www.devliberty.net/home/frAgence de communication digitale https://www.devliberty.net/home/frConception site web pour entreprises https://www.devliberty.net/home/frAgences marketing web et digital marketing https://www.devliberty.net/home/frNous nous engageons à fournir des résultats tangibles avec des prix de création de site internet compétitifs et une approche personnalisée. Contactez-nous pour découvrir comment nous pouvons améliorer votre présence en ligne.
At Kingdom Keys Store, we offer a wide range of digital products and software solutions, including https://kingdomkeys.store/products/Fortnite-Accounts/en Fortnite Accounts, https://kingdomkeys.store/products/GTA-5-Accounts/en GTA 5 Accounts, and https://kingdomkeys.store/products/EA-Sports-FC-Accounts/en EA Sports FC Accounts for gaming enthusiasts. Enhance your productivity with https://kingdomkeys.store/products/Microsoft-office/en Microsoft Office and manage your operations efficiently with https://kingdomkeys.store/products/windows-server/en Windows Server. Our https://kingdomkeys.store/products/Quickbooks/en QuickBooks solutions streamline financial management, while https://kingdomkeys.store/products/corel-draw/en Corel Draw and https://kingdomkeys.store/products/Adobe/en Adobe software provide powerful tools for graphic design. Explore our offerings and find the perfect solutions for your needs.
Microsoft Windows 11 Professional
Microsoft Windows 10 Professional
Microsoft Windows 10 Home
Microsoft Windows 11 Home
Microsoft Office 2021 Professional Plus Lifetime
Microsoft Office 2019 Home & Business Lifetime
Microsoft Office 2016 Personal Lifetime
Microsoft Office 2016 Home & Business Lifetime
Microsoft Office 2016 Home & Student Lifetime
Windows Server 2022 Standard
Windows Server 2019 Standard
Windows Server 2022 Datacenter
Windows Server Remote Desktop Services 50 User CAL 2019
Windows Server Remote Desktop Services 50 User CAL 2021
Windows Server Remote Desktop Services 50 User CAL 2016
Windows Essentials 2019
Windows Server 2016 Datacenter
Windows Server 2016 Standard
Windows Essentials 2016
Windows Essentials 2012 R2
Windows Server 2012 R2 Datacenter
Windows Server 2012 R2 Standard
Windows Server 2012 Datacenter
Windows Server 2012 Standard
Come and visit us now to learn more about our affordable insurance plans.
nice
Pour résoudre ce problème, la directive `SetEnvIf` du module `mod_setenvif` est votre amie. En définissant une variable d'environnement basée sur l'URI de la requête, vous pouvez contrôler ce qui est enregistré. Par exemple, si vous souhaitez ignorer les journaux de « my_page.php », vous pouvez simplement ajouter les lignes suivantes dans votre vhost ou votre fichier de configuration :
```Apache
SetEnvIf Request_URI "ma_page.php$" donotlog
CustomLog /dev/null env=donotlog
CustomLog /var/log/apache2/access_atelier_dev.log combiné env=!donotlog
```
Ce que cela fait est simple : cela indique à Apache de supprimer toutes les entrées de journal pour les requêtes adressées à « my_page.php » en les envoyant à « /dev/null », tout en conservant les journaux pour tout le reste. De plus, vous pouvez ajouter plusieurs directives `SetEnvIf` si vous avez plus de pages à exclure ou même définir des conditions pour enregistrer uniquement des scripts spécifiques.
Juste un petit rappel : après avoir effectué ces modifications, n'oubliez pas de redémarrer Apache pour qu'il récupère la nouvelle configuration ! Ce petit ajustement peut vraiment vous aider à garder vos journaux pertinents et gérables.
I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.