Vous n'êtes pas identifié(e).
- Contributions : Récentes | Sans réponse
Pages : 1
#1 11/07/2018 13:23:46
- mortimer.pw
- Membre
Tail_n_mail
Bonjour,
Je travaille sur des moteurs entre 9.3 et 10.1 sous Cent-OS 6/7.
J'utilise tail_n_mail, mis en crontab (toutes les minutes), pour surveiller les logs de PostgreSQL et être averti au plus tôt d'un problème.
J'ai mis ça dans mon fichier des INCLUDE/EXCLUDE :
## Fichier des Include_Exclude
INCLUDE: WARNING:
INCLUDE: ERROR:
INCLUDE: FATAL:
INCLUDE: PANIC:
EXCLUDE: relation " +" does not exist
EXCLUDE: duplicate key value violates unique constraint "pk_doublon_prod"
Je n'arrive pas à filtrer, pour ne pas recevoir de mail, sur l'erreur : duplicate key value violates unique constraint "pk_doublon_prod"
Quelle syntaxe utiliser pour ne pas recevoir les alertes sur ce message précis, svp ?
Hors ligne
#2 11/07/2018 16:13:13
- gleu
- Administrateur
Re : Tail_n_mail
Normalement, ça devrait fonctionner ainsi. Utiliser l'option --debug pourrait permettre d'en savoir plus.
Guillaume.
Hors ligne
#3 13/07/2018 08:46:57
- mortimer.pw
- Membre
Re : Tail_n_mail
Bonjour,
En ajoutant l'option --debug, j'obtiens les infos suivantes :
perl /home/postgres/scripts/tail_n_mail --dryrun --debug /home/postgres/scripts/tnm.config.txt
Opened config file "/home/postgres/scripts/tnm.config.txt"
$opt1 = {
'configfile' => {
'lastfile' => 1,
'file.HASH(0x200b178)' => 1,
'file' => 1,
'customsubject' => 1,
'email' => 1,
'email.admin_pg@toto.fr' => 1,
'inherit./home/postgres/scripts/lst_include_exclude.txt' => 1,
'mailsubject' => 1,
'inherit' => 1,
'offset' => 1
},
'lastfile' => {
'1' => '/home/postgres/pg_log/5-09.log'
},
'file' => [
{
'lastfile' => '/home/postgres/pg_log/5-09.log',
'original' => '/home/postgres/pg_log/%u-%H.log',
'suffix' => '1',
'name' => '/home/postgres/pg_log/5-09.log',
'offset' => '1844263'
}
],
'customsubject' => 1,
'email' => [
'admin_pg@toto.fr'
],
'mailsubject' => 'Alerte PostgreSQL HOST',
'inherit' => [
'/home/postgres/scripts/lst_include_exclude.txt'
],
'offset' => {
'1' => '1844263'
}
};
$arg1 = {
'verbose' => 1,
'log_line_prefix' => '',
'mailserver' => 'example.com',
'find_line_number' => 1,
'file' => [],
'sortby' => 'count',
'maxsize' => 80000000,
'mailuser' => 'example',
'tsepnosub' => 0,
'debug' => 1,
'duration_limit' => 0,
'sqlstate' => 0,
'dryrun' => 1,
'timewarp' => 0,
'pgmode' => 1,
'nomail' => 0,
'canceled_autovac' => 1,
'duration' => -1,
'statement_size' => 1000,
'mailport' => 465,
'tsep' => undef,
'flatten' => 1,
'type' => 'normal',
'skip_non_parsed' => 0,
'smtp' => 0,
'tempfile_limit' => 0,
'tempfile' => -1,
'hideflatten' => 1,
'mailcom' => '/usr/sbin/sendmail',
'maxemailsize' => 10000000,
'reset' => 0,
'pretty_query' => 1,
'help' => 0,
'mailmode' => 'sendmail',
'mailpass' => 'example',
'offset' => -1,
'quiet' => 0,
'showonly' => 0,
'version' => 0,
'mailsig' => [],
'mailzero' => 0,
'rewind' => 0,
'pglog' => 'pg'
};
Log line prefix regex: (?^:^((\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d \w\w\w\w?) \[(\d+)\])(.*))
Log line prefix regex2: (?^:^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d \w\w\w\w? \[\d+\])
Log line prefix regex3: (?^:^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d \w\w\w\w?)
Parsing file: /home/postgres/pg_log/5-09.log
File: /home/postgres/pg_log/5-09.log Offset: 1,844,263 Size: 1,853,020 Maxsize: 80,000,000
Adding exclusion: relation " +" does not exist
Adding exclusion: duplicate key value violates unique constraint "pk_doublon_prod"
Exclusion: (?^:relation " +" does not exist)|(?^:duplicate key value violates unique constraint "pk_doublon_prod")
Adding inclusion: WARNING:
Adding inclusion: ERROR:
Adding inclusion: FATAL:
Adding inclusion: PANIC:
Inclusion: (?^:WARNING:)|(?^:ERROR:)|(?^:FATAL:)|(?^:PANIC:)
No new lines found in file /home/postgres/pg_log/5-09.log
Performing final cleanup
Hors ligne
Pages : 1