Pomoc Syslog spakowane logi

KrzysiekK

Passing Basics
Beginner
30 Marzec 2016
26
1
3
44
QNAP
TS-x51
Ethernet
1 GbE
Wersja oprogramowania Firmware: 4.3.2.0050
Model serwera: QNAP TS-251


Witam. Loguje poprzez syslog logi z urządzeń w sieci. Logi zajmują dużo miejsca. Jest możliwość aby Qnap sam pakował paczki jakimś zipem ?
 
po najmniejszej linii oporu :
Bash:
gzip -9 /share/Download/messages.*

Bash:
[/share/Download] # gzip -9 /share/Download/messages
[/share/Download] # ll
total 16
drwxrwxrwx    3 admin    administ    4.0K Jan 22 13:04 ./
drwxrwxrwx   37 admin    administ    4.0K Oct 12 17:55 ../
drwxrwxrwx    2 admin    administ    4.0K Jan 19 17:56 @Recycle/
-rw-r--r--    1 admin    administ      20 Jan 22 13:04 messages.gz
[/share/Download] # touch messages.1
[/share/Download] # touch messages.2
[/share/Download] # touch messages.3
[/share/Download] # touch messages.4
[/share/Download] # ll
total 16
drwxrwxrwx    3 admin    administ    4.0K Jan 22 13:27 ./
drwxrwxrwx   37 admin    administ    4.0K Oct 12 17:55 ../
drwxrwxrwx    2 admin    administ    4.0K Jan 19 17:56 @Recycle/
-rw-r--r--    1 admin    administ       0 Jan 22 13:27 messages.1
-rw-r--r--    1 admin    administ       0 Jan 22 13:27 messages.2
-rw-r--r--    1 admin    administ       0 Jan 22 13:27 messages.3
-rw-r--r--    1 admin    administ       0 Jan 22 13:27 messages.4
-rw-r--r--    1 admin    administ      20 Jan 22 13:04 messages.gz
[/share/Download] # gzip -9 messages.
gzip: messages.: No such file or directory
[/share/Download] # gzip -9 messages.*
[/share/Download] # ll
total 32
drwxrwxrwx    3 admin    administ    4.0K Jan 22 13:27 ./
drwxrwxrwx   37 admin    administ    4.0K Oct 12 17:55 ../
drwxrwxrwx    2 admin    administ    4.0K Jan 19 17:56 @Recycle/
-rw-r--r--    1 admin    administ      20 Jan 22 13:27 messages.1.gz
-rw-r--r--    1 admin    administ      20 Jan 22 13:27 messages.2.gz
-rw-r--r--    1 admin    administ      20 Jan 22 13:27 messages.3.gz
-rw-r--r--    1 admin    administ      20 Jan 22 13:27 messages.4.gz
-rw-r--r--    1 admin    administ      39 Jan 22 13:27 messages.gz.gz
[/share/Download] # rm messages.?.gz
[/share/Download] # ll
total 16
drwxrwxrwx    3 admin    administ    4.0K Jan 22 13:28 ./
drwxrwxrwx   37 admin    administ    4.0K Oct 12 17:55 ../
drwxrwxrwx    2 admin    administ    4.0K Jan 19 17:56 @Recycle/
-rw-r--r--    1 admin    administ      39 Jan 22 13:27 messages.gz.gz
[/share/Download] # rm messages.gz.gz
[/share/Download] # touch messages
[/share/Download] # touch messages.1
[/share/Download] # touch messages.2
[/share/Download] # touch messages.3
[/share/Download] # cd ..
[/share] # gzip -9 /share/Download/messages.*
[/share] # ll /share/Download
lrwxrwxrwx    1 admin    administ      23 Jan 11 20:06 /share/Download -> CACHEDEV1_DATA/Download/
[/share] # ll /share/Download/
total 24
drwxrwxrwx    3 admin    administ    4.0K Jan 22 13:28 ./
drwxrwxrwx   37 admin    administ    4.0K Oct 12 17:55 ../
drwxrwxrwx    2 admin    administ    4.0K Jan 19 17:56 @Recycle/
-rw-r--r--    1 admin    administ       0 Jan 22 13:28 messages
-rw-r--r--    1 admin    administ      20 Jan 22 13:28 messages.1.gz
-rw-r--r--    1 admin    administ      20 Jan 22 13:28 messages.2.gz
-rw-r--r--    1 admin    administ      20 Jan 22 13:28 messages.3.gz
 
a logrotate?

dosc stary watek, ale mozna znalezc przystepny opis tego rozwiazania
rsyslog - QNAP NAS Community Forum

lub tu
Setting Up Logrotate on RedHat Linux - LinuxConfig.org
NSLU2-Linux - Optware / Logrotate browse

przykladowy konfig:

Kod:
[admin@NASA syslog]# cat /etc/logrotate.conf
rotate 7
daily
missingok
notifempty
compress
delaycompress
su admin administrators
create 640 admin administrators
/share/CACHEDEV1_DATA/syslog/messages {
	rotate 30
	olddir oldlogs
	postrotate
		/usr/bin/killall -HUP rsyslogd
	endscript
}

wpis do crontab (00:15, codziennie)
Kod:
15 0 * * * /usr/sbin/logrotate -f /etc/logrotate.conf 2>/dev/null
 

Użytkownicy znaleźli tą stronę używając tych słów:

  1. syslog