linux:logwatch

Introduction

Logwatch est un outil simple et efficace qui permet notamment d'analyser les logs d'un serveur linux et d'en produire un compte rendu qui peut être envoyé par mail.

C'est un outil que j'ai l'habitude d'utiliser systématiquement dans la mesure ou il est toujours bon de suivre ce qu'il se passe sur son serveur. Hors, analyser tous les logs régulièrement est tout bonnement impossible. Avec logwatch on peut avoir une synthèse journalière qui permet d'avoir un bon niveau d'information et détecter des problèmes potentiels afin de les corriger.

Configuration

Je ne vais pas faire le détail de la configuration qui est déjà bien expliquée1) un peu partout. Par contre pour rappel je dirais que ce petit logiciel à la mauvaise habitude de ne pas mettre sa configuration sous :

/etc

mais sous

/usr/share/logwatch/default.conf

D'une manière générale ce wiki est pas mal.

Erreurs rencontrées

A priori sous certaines version de debian (squeeze ?) la configuration par défaut pour un rapport HTML ne fonctionne pas. Mais elle peut comme toujours être résolue2).

Le problème vient du fait qu'il manque dans la version de logwatch livrée avec ce debian est bancale pour les rapports html car il manque le dossier suivant :

/usr/share/logwatch/default.conf/html/

Et plus exactement il manque ces deux fichiers :

/usr/share/logwatch/default.conf/html/header.html
/usr/share/logwatch/default.conf/html/footer.html

Il suffit donc de les recréer (les droits peuvent être laissés par défaut quand on les crée en root) avec le contenu ci dessous.

Pour le header :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Logwatch  $Version  ( $VDate )</title>
<meta name="generator" content="Logwatch  $Version ( $VDate )">
<style type="text/css">
  h1 {color: gray; border-bottom: 3px double silver}
  h2,h3 {color: gray; border-bottom: 1px solid silver}
  .ref {padding-left: 1%}
  .service {padding-left: 1%; font-family: Monospace}
  .return_link {border-top: 1px; border-bottom: 1px;
  padding: 1%; margin-top: 1%; margin-bottom: 1%;}
  .copyright {color: black; border-top: 1px solid grey;
  border-bottom: 1px solid grey;
  padding: 1%; margin-top: 1%; margin-bottom: 1%;}
</style>
</head>
<body style="width:90%; margin-left: 5%; margin-right: 5%" bgcolor="#FFFFFF">
<hr>
<!-- End header.html -->

Pour le footer :

<!-- Start footer.html -->
<div class=\"copyright\">
<hr>
<p>Logwatch &copy;Copyright 2002-2006 Kirk Bauer</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</p></div>
</body></html>

  • linux/logwatch.txt
  • Dernière modification : 2021/04/18 22:24
  • de 127.0.0.1