View previous topic :: View next topic |
Author |
Message |
lan Apprentice
Joined: 06 Mar 2004 Posts: 215 Location: Verona, Italy (Romeo & juliet`s City)
|
Posted: Tue Apr 05, 2005 2:52 pm Post subject: [Risolto]syslog-ng log rotation |
|
|
salve gente non sono riuscito a fare la log rotation con syslog-ng.. qualcuno ha idea di come si fa.. tipo splittare i log di iptables in un file a parte ?
o ache di named ?
GRazie
ps: ho già rtfm ma non ho ottenuto risultati e poi un mini how to su questa cosa può essere utile e interessate
Ciao _________________ --
http://www.giuseppe-marocchio.com
skype: l4nz0r /voice
USH team www.ush.it
Last edited by lan on Wed Apr 06, 2005 5:48 pm; edited 3 times in total |
|
Back to top |
|
|
.:chrome:. Advocate
Joined: 19 Feb 2005 Posts: 4588 Location: Brescia, Italy
|
Posted: Tue Apr 05, 2005 2:54 pm Post subject: Re: syslog-ng log rotation |
|
|
ma non è una funzione di syslog-ng
installa logrotate |
|
Back to top |
|
|
lan Apprentice
Joined: 06 Mar 2004 Posts: 215 Location: Verona, Italy (Romeo & juliet`s City)
|
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 31021 Location: here
|
Posted: Tue Apr 05, 2005 3:23 pm Post subject: |
|
|
Mi pare che queste cose le permetta solo metalog senza programmi aggiuntivi (ma potrei sbagliarmi) _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
DiMar Tux's lil' helper
Joined: 10 Feb 2005 Posts: 127 Location: Milan, Italy
|
Posted: Tue Apr 05, 2005 5:11 pm Post subject: Re: syslog-ng log rotation |
|
|
k.gothmog wrote: | ma non è una funzione di syslog-ng
installa logrotate |
Quoto:
Code: | * app-admin/logrotate
Available versions: 3.6.5-r1 ~3.7
Installed: no
Homepage: http://packages.debian.org/unstable/admin/logrotate.html
Description: Rotates, compresses, and mails system logs |
Cmq si può fare anche a manina con uno script bash! _________________ :: Divin Marchese
"Entro giusti confin virtù si tiene,
se oltrepassarli vuoi vizio diviene!"
(D.A.F de Sade) |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Tue Apr 05, 2005 5:58 pm Post subject: Re: syslog-ng log rotation |
|
|
DiMar wrote: |
Cmq si può fare anche a manina con uno script bash! |
Non ne vedo il motivo se c'è già una bella applicazione pronta _________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
lan Apprentice
Joined: 06 Mar 2004 Posts: 215 Location: Verona, Italy (Romeo & juliet`s City)
|
Posted: Tue Apr 05, 2005 6:38 pm Post subject: |
|
|
mmm ok guardo logrotate e prometto di diffidare dai post it che la notte mi attacco sulla scrivania ;D
metto il tag risolto così chiudiamo qui il thread _________________ --
http://www.giuseppe-marocchio.com
skype: l4nz0r /voice
USH team www.ush.it |
|
Back to top |
|
|
DiMar Tux's lil' helper
Joined: 10 Feb 2005 Posts: 127 Location: Milan, Italy
|
Posted: Tue Apr 05, 2005 7:12 pm Post subject: Re: syslog-ng log rotation |
|
|
gutter wrote: |
Non ne vedo il motivo se c'è già una bella applicazione pronta |
Hai ragione, ma sto studiando un po' di libri sullo scripting e mi sto intrippando di brutto... _________________ :: Divin Marchese
"Entro giusti confin virtù si tiene,
se oltrepassarli vuoi vizio diviene!"
(D.A.F de Sade) |
|
Back to top |
|
|
leon_73 Guru
Joined: 13 Mar 2003 Posts: 505 Location: Milano
|
Posted: Wed Apr 06, 2005 9:37 am Post subject: |
|
|
Scusate una cosina, ma non ho capito se lan volesse un rotazione dei log o lo split per ogni applicativo.
Code: |
#
# Syslog-ng default configuration file for Gentoo Linux
# contributed by Michael Sterrett
options {
long_hostnames(off);
sync(0);
# The default action of syslog-ng 1.6.0 is to log a STATS line
# to the file every 10 minutes. That's pretty ugly after a while.
# Change it to every 12 hours so you get a nice daily update of
# how many messages syslog-ng missed (0).
stats(43200);
};
source src { unix-stream("/dev/log"); internal(); pipe("/proc/kmsg"); };
destination d_messages { file("/var/log/Messages/messages_$YEAR$MONTH$DAY"); };
# By default messages are logged to tty12...
# destination console_all { file("/dev/tty12"); };
# ...if you intend to use /dev/console for programs like xconsole
# you can comment out the destination line above that references /dev/tty12
# and uncomment the line below.
#destination console_all { file("/dev/console"); };
log { source(src); destination(d_messages); };
|
Quello che trovi sopra e' il file di conf del mio portatile... non me ne frega molto di dividere i log per applicazione ma cosi' ne ho uno al giorno...
Code: | z-lmutt@localhost ~ $ ls -l /var/log/Messages/
totale 2596
-rw------- 1 root root 316292 11 mar 13:50 messages_20050310.gz
-rw------- 1 root root 27812 11 mar 21:15 messages_20050311.gz
-rw------- 1 root root 10333 12 mar 10:32 messages_20050312.gz
-rw------- 1 root root 8882 13 mar 21:43 messages_20050313.gz
-rw------- 1 root root 57345 14 mar 23:21 messages_20050314.gz
-rw------- 1 root root 6961 15 mar 10:05 messages_20050315.gz
-rw------- 1 root root 9960 16 mar 15:03 messages_20050316.gz
-rw------- 1 root root 39229 17 mar 23:26 messages_20050317.gz
-rw------- 1 root root 21032 18 mar 22:24 messages_20050318.gz
-rw------- 1 root root 8495 19 mar 17:52 messages_20050319.gz
-rw------- 1 root root 13773 20 mar 11:14 messages_20050320.gz
-rw------- 1 root root 16925 21 mar 23:44 messages_20050321.gz
-rw------- 1 root root 39000 23 mar 00:23 messages_20050322.gz
-rw------- 1 root root 27480 23 mar 19:16 messages_20050323.gz
-rw------- 1 root root 25224 24 mar 18:03 messages_20050324.gz
-rw------- 1 root root 8373 28 mar 22:40 messages_20050328.gz
-rw------- 1 root root 179132 29 mar 15:33 messages_20050329
-rw------- 1 root root 204071 30 mar 19:28 messages_20050330
-rw------- 1 root root 221884 31 mar 23:05 messages_20050331
-rw------- 1 root root 128488 3 apr 01:59 messages_20050402
-rw------- 1 root root 202386 3 apr 21:29 messages_20050403
-rw------- 1 root root 590659 5 apr 00:51 messages_20050404
-rw------- 1 root root 227767 5 apr 19:03 messages_20050405
-rw------- 1 root root 164357 6 apr 11:16 messages_20050406
|
Se invece li vuoi splittati per applicativo, devi ceracarti la variabile adatta (che ora non mi ricordo) generi la destination e il log...
Leo |
|
Back to top |
|
|
lan Apprentice
Joined: 06 Mar 2004 Posts: 215 Location: Verona, Italy (Romeo & juliet`s City)
|
|
Back to top |
|
|
grentis Guru
Joined: 20 Jul 2004 Posts: 321
|
Posted: Wed Apr 06, 2005 1:31 pm Post subject: |
|
|
Questo è il mio syslog-ng.conf
Code: | # $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.conf.gent
oo,v 1.4 2004/07/18 02:25:02 dragonheart Exp $
#
# Syslog-ng default configuration file for Gentoo Linux
# contributed by Michael Sterrett
options {
long_hostnames(off);
sync(0);
# The default action of syslog-ng 1.6.0 is to log a STATS line
# to the file every 10 minutes. That's pretty ugly after a while.
# Change it to every 12 hours so you get a nice daily update of
# how many messages syslog-ng missed (0).
stats(43200);
};
source src { unix-stream("/dev/log"); internal(); pipe("/proc/kmsg"); };
destination messages { file("/var/log/messages"); };
filter f_messages { not match("ssh") and not match("proftp") and not match("pppd
") and not match("ddclient") and not match("dhcp"); };
destination sshlog { file("/var/log/net/ssh.log"); };
filter f_ssh { match("ssh"); };
destination ftplog { file("/var/log/net/ftp.log"); };
filter f_ftp { match("proftp"); };
destination ppplog { file("/var/log/net/pppd.log"); };
filter f_ppp { match("pppd"); };
destination ddclientlog { file("/var/log/net/pppd.log"); };
filter f_ddclient { match("ddclient"); };
destination dddhcp { file("/var/log/net/dhcp.log"); };
filter f_dddhcp { match("dhcp"); };
# By default messages are logged to tty12...
# destination console_all { file("/dev/tty12"); };
# ...if you intend to use /dev/console for programs like xconsole
# you can comment out the destination line above that references /dev/tty12
# and uncomment the line below.
# destination console_all { file("/dev/console"); };
log { source(src); filter(f_messages); destination(messages); };
log { source(src); filter(f_ssh); destination(sshlog); };
log { source(src); filter(f_ftp); destination(ftplog); };
log { source(src); filter(f_ppp); destination(ppplog); };
log { source(src); filter(f_ddclient); destination(ddclientlog); };
log { source(src); filter(f_dddhcp); destination(dddhcp); };
# log { source(src); destination(console_all); };
|
Così vengono creati diversi file in base al log |
|
Back to top |
|
|
leon_73 Guru
Joined: 13 Mar 2003 Posts: 505 Location: Milano
|
Posted: Wed Apr 06, 2005 1:33 pm Post subject: |
|
|
per quello ti consiglio di dare un occhiata a questo PDF facendo particolare alla funzione dei filtri e della voce facility.
Leo |
|
Back to top |
|
|
leon_73 Guru
Joined: 13 Mar 2003 Posts: 505 Location: Milano
|
Posted: Wed Apr 06, 2005 1:48 pm Post subject: |
|
|
e nel caso ti prendesse la pigrizia
Code: | source src { unix-stream("/dev/log"); internal(); pipe("/proc/kmsg"); };
destination std { file( "/var/log/Test/$FACILITY"); };
log { source(src); destination(std); }; |
Syslog in 3 righe
Ciao |
|
Back to top |
|
|
lan Apprentice
Joined: 06 Mar 2004 Posts: 215 Location: Verona, Italy (Romeo & juliet`s City)
|
Posted: Wed Apr 06, 2005 2:48 pm Post subject: |
|
|
perdona l'ignoranza di un povero incompentente ma quello cosa splitta? tutto o l'aplicazione $FACILITY ?
Ciao E grazie mille _________________ --
http://www.giuseppe-marocchio.com
skype: l4nz0r /voice
USH team www.ush.it |
|
Back to top |
|
|
leon_73 Guru
Joined: 13 Mar 2003 Posts: 505 Location: Milano
|
Posted: Wed Apr 06, 2005 3:03 pm Post subject: |
|
|
lan wrote: | perdona l'ignoranza di un povero incompentente ma quello cosa splitta? tutto o l'aplicazione $FACILITY ?
Ciao E grazie mille |
$FACILITY e' una macro...
attivando le tre righe ti ho postato, e facendo "sudo su -", ho ottenuto: Code: | root@localhost
Test # ll
totale 12
-rw------- 1 root root 105 6 apr 16:56 local2
-rw------- 1 root root 168 6 apr 16:56 auth
-rw------- 1 root root 154 6 apr 16:56 syslog
Giusto per darti un'idea contengono
./auth:1:Apr 6 16:56:08 localhost su(pam_unix)[3351]: session opened for user root by z-lmutt(uid=0)
./auth:2:Apr 6 16:56:09 localhost su(pam_unix)[3351]: session closed for user root
./local2:1:Apr 6 16:56:08 localhost sudo: z-lmutt : TTY=pts/2 ; PWD=/home/z-lmutt ; USER=root ; COMMAND=/bin/su -
./syslog:1:Apr 6 16:55:55 localhost syslog-ng[3263]: syslog-ng version 1.6.5 starting
./syslog:2:Apr 6 16:56:45 localhost syslog-ng[3263]: syslog-ng version 1.6.5 going down
|
Se invece vuoi dare qualcosa di piu' mirato prenditi l'esempio della configurazione che ti ha postato grentis
Leo |
|
Back to top |
|
|
|