Logi

Allikas: Kuutõrvaja
Redaktsioon seisuga 11. juuni 2007, kell 13:45 kasutajalt Jj (arutelu | kaastöö)

sissejuhatus

logimist korraldab serveris tarkvara nimega syslog levinud on ka täiustatud logimootor nimega syslog-ng


logikliendi seadistus

syslog.conf'is näiteks kui on rida


auth,authpriv.*                 /var/log/auth.log


siis võib tekitada kõrvale


auth,authpriv.*                 @192.168.1.10


teenuste logimine läbi syslog'i

Osa tarkvara ei kasuta logimiseks sysloq'i vaid eelistavad ise tegeleda logi kirjutamiega näit apache nende tarkvaradega tuleb rohkem vaeva näha


Näiteks apachel

asendame rea

ErrorLog /var/log/httpd/error.log

reaga

ErrorLog syslog:local4

ja access log'i jaoks

CustomLog "|/usr/bin/logger -p local5.info" combined


syslog.conf muudatused tulevad


destination loghost { udp("192.168.1.10"); };

filter f_local5 { facility(local5); };
filter f_local4 { facility(local4); };

destination http_error { file("/var/log/httpd/error.log"); };
destination http_access { file("/var/log/httpd/access.log"); };

log { source(src); filter(f_local4); destination(loghost); };
log { source(src); filter(f_local4); destination(http_error); };
log { source(src); filter(f_local5); destination(loghost); };
log { source(src); filter(f_local5); destination(http_access); };


logiserveri seadistus

pärast syslog-ng installi lisame seadistusfailine näiteks sellise osa


source net {
        udp();
};


destination remote {
   file("/log/serverid/$FULLHOST/messages.log"
  owner(root) group(wheel) perm(0600) dir_perm(0700) create_dirs(yes));
};
 

destination remote_auth {
   file("/log/serverid/$FULLHOST/auth.log"
   owner(root) group(wheel) perm(0600) dir_perm(0700) create_dirs(yes));
};

destination remote_mail {
   file("/log/serverid/$FULLHOST/mail.log"
   owner(root) group(wheel) perm(0600) dir_perm(0700) create_dirs(yes));
};

destination remote_http_error {
   file("/log/serverid/$FULLHOST/http_error.log"
   owner(root) group(wheel) perm(0600) dir_perm(0700) create_dirs(yes));
};

destination remote_http_access {
   file("/log/serverid/$FULLHOST/http_access.log"
   owner(root) group(wheel) perm(0600) dir_perm(0700) create_dirs(yes));
}; 


destination swatch {
        program("/usr/local/bin/swatch --read-pipe=\"cat /dev/fd/0\"");
};