시스템 최적화 - 로그파일 분석 및 효율적으로 관리하기.txt
23KB · 796 lines
�ý��� ���ȭ - �α���� �м� �� ȿ�������� �����ϱ�
�۾��� : 2000�� 2�� 22��(ȭ)
�۾��� : �����
(http://www.taejun.pe.kr, taejun@taejun.pe.kr, taejun@hitel.net)
���ڷ�
man syslogd.conf
man sysklogd
man logrotate
20����� ���ڸ�ϰ� sendmail(���� 99�� 5��)�� �α� ��� �����κ�
��Ÿ ������ �� ���н� �ý��� ���� ���� ����
0. ����
�ý��ۿ��� ���� �α��, ��ϵ� ��� �ý��� Ȱ���� ���� �α� ���
�ϰ� �̸� ������ �ý���� ������ ���ؼ� �м��� �� �ִ�.
�ý���� �αװ� � ����� ��ϵǰ� � �ǹ̸� ������ �ִ��,
�̸� ��� Ȱ���ؾ���� �ý��� �����ڶ�� �ݵ�� �����ϰ� �־��
�� ��̴�.
�ұԸ�� ������ ��ϴ� ��� �α���Ͽ� �״�� �Ű� ���� ��� ����.
������ �����ϴ� ���� ������� �Ը� Ŀ�� ��� ����ġ ���� ����
�� ������ ����� ��� ����. ��� �ϳ��� ��û���� �����ϴ� �α���Ϲ���
�̴�.
���� ����. �Ϸ翡 10����� ���ڸ��� ó���ϴ� ��츦 �����غ���.
sendmail�� ���ڸ��� �����ϸ鼭 �� �� ����� syslogd�� �̿�
/var/log/maillog�� �����Ѵ�. (�̴� ������ ���� �ٸ� �� �ִ�) ����
��� pop3�� ����� ���� ������ ��ϰ� ���� ������ ��ϱ�
����Ǿ���Ѵ�.
������� ���ڸ��� ���۵Ǵ� ��� ��ϵǴ� ����� 560 ���Ʈ����
�̴�. ������ ���۽� ������ ���� ��쿡�� �� ���� Ƚ���� ���� ����
����� �߰��ȴ�. ��� �ϳ��� ���ڸ��� 1KB ������ �α� ����Ѵ�
�� �غ���. �Ϸ翡 10������ ���� �����Ѵٸ� �Ϸ��� �α�� ũ�⸸
100M �̰� ����̸� 700MB�̴�.
��� ��ϰ��� 1000��̰� �� ���ڰ� 5�и��� pop3�� ���� Ȯ��
�Ѵٰ� ��� ��츦 �߰��ؾ��Ѵ�. �ѹ��� �� 0.2KB�� �αװ� ��̸�
�ð��� 12��(5�п� �ѹ��� Ȯ���ϴ� ���), �Ϸ� 8�ð� �ٹ��� 96���̰�
96*0.2KB = 192kb�̴�. 1000��̹Ƿ� 192MB�� �ǰ� ����̸� �Ͽ���
�����ϴ��� 1.15G������ �ȴ�.
�� ���� ��Ͽ뷮�� 10M�� �Ҵ��ϸ� ���ڸ��� ������ �뷮������
10G�� �ʿ��ϰ� �α� ���� 2G �̻�� �ʿ��ϴ�. ���⼭ �׳� 2G��
������ ��� �ƴ϶� rotate ���� 4��� 8G�� �ȴ�. ��� ������ ��Ȳ��
������ �ʴ°�?
���⼭�� ������ ��� �ƴϴ�. syslogd�� maillog�� ������ ��� �α�
�� ����ϴµ� �α����� 1M�̻� �Ѿ�� �ϳ��� ����� ó���ϱ�
���� �ý��� �ڿ��� 10% �̻� ����Ѵٰ� �ϸ� 10M�� ����� 40% �̻�,
100M�� ����� 80% �̻�� �ý��� �ڿ��� ����Ѵٰ� �Ѵ�. (���� �̴�
�ڽ�� �ý��� ��Ȳ�� ���Ӿ��� ������ؼ� �ڽſ� ���߾�� �� ���
��) �ᱹ ���� �����ϴµ� �ڿ��� ����ؾ��ϴµ� ��û���� Ŀ��
�α���϶����� �ý���� �ڿ��� ������ ���߿��� ���ڸ�� �����
�ƴ϶� �α� ��Ͽ� ��� cpu �ð��� ����ؾ��Ѵ�. �ϵ� ��ũ��
���ϰ� ����ϴ� �۾��� ������ �ý���� ����� �ް��ϰ� ������.
��� �������α� ���� ���캸��. �̿�ڰ� ������ ������ ��ϵǴ�
access_log�� �ѹ� ���Ӵ� �� 85Byte�� �����Ѵ�. �Ϸ� 10���� ����
�ϸ� 8.5M�̴�. ����̸� 59.5M�̴�. �Ѵ�̸� 255M�̴�. ������
�� �Ը� �� ũ�ٸ� �α����� �����ϰ� �����ϴµ��� �� ����
�ý��� �ڿ��� ����� ��̴�.
����� �̷��� ��Ȳ�ϰ� �̾߱��Ѱ�� �����ڰ� �α� ��Ͽ� �Ű�
���� �ʴ´ٸ� ��Ը� ���� �����ϸ鼭 �� ū ������ ����
�ִ���� �˷��ְ�� �ϱ� ����̴�. ���� ���� Ȩ����������
�� ������ ������ �ʰ����....
�α� ���� � ����� ������ ��ΰ�? ��å�� ���� ��� �����ڰ�
�ؾ� �� ��̶� �����ϸ� ������� �α� ���� ���� �� ����̼�
�� ���ؼ� ���� �Ѵ�. ��ڰ� å�� �״�� ������� �ʾƼ� ����
�� �ڴµ� ���н� ���� ���� �������� �̿� ���ؼ��� �� �ڼ��
������ �ʾƼ� �̹� ��ȸ�� �̿��� �����غ���� �Ѵ�.
1. �ý��� �α� ��� (syslog)
�Ϲ������ ����� ��ġ�� �α����� ����ϴ� ��Ű���� �ڵ�����
��ġ�ȴ�.
# rpm -qa | grep log
logrotate-3.3-1 --->> �α� �����Ʈ(��ȯ)
sysklogd-1.3.31-12 --->> �ý��� �α� ���
# rpm -ql sysklogd
/etc/logrotate.d/syslog
/etc/rc.d/init.d/syslog
/etc/rc.d/rc0.d/K99syslog
/etc/rc.d/rc1.d/K99syslog
/etc/rc.d/rc2.d/S30syslog
/etc/rc.d/rc3.d/S30syslog
/etc/rc.d/rc5.d/S30syslog
/etc/rc.d/rc6.d/K99syslog
/etc/syslog.conf --->> �������
/sbin/klogd --->> Ŀ�� �α� ���
/sbin/syslogd --->> �ý��� �α� ���
/usr/doc/sysklogd-1.3.31
/usr/doc/sysklogd-1.3.31/ANNOUNCE
/usr/doc/sysklogd-1.3.31/INSTALL
/usr/doc/sysklogd-1.3.31/NEWS
/usr/doc/sysklogd-1.3.31/README.1st
/usr/doc/sysklogd-1.3.31/README.linux
/usr/doc/sysklogd-1.3.31/Sysklogd-1.3.lsm
/usr/man/man5/syslog.conf.5
/usr/man/man8/klogd.8
/usr/man/man8/sysklogd.8
/usr/man/man8/syslogd.8
���� �������丮�� ���� ��� �����ؼ��� �״�� �����
��� �ʰ� ����� �������� ����� �Ǿ���.
# ps aux | head -n10
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 1168 56 ? S 14:07 0:05 init [3]
root 2 0.0 0.0 0 0 ? SW 14:07 0:00 [kflushd]
root 3 0.0 0.0 0 0 ? SW 14:07 0:00 [kupdate]
root 4 0.0 0.0 0 0 ? SW 14:07 0:00 [kpiod]
root 5 0.0 0.0 0 0 ? SW 14:07 0:05 [kswapd]
root 6 0.0 0.0 0 0 ? SW< 14:07 0:00 [mdrecoveryd]
root 285 0.0 0.5 1232 180 ? S 14:07 0:00 syslogd -m 0
root 296 0.0 0.0 1464 0 ? SW 14:07 0:00 [klogd]
���� ���� ���� �α� ��� �ý���� ���ý� ��â� ����� �ȴ�.
���� ���� ��� /etc/syslog.conf �� ���캸��. syslod�� ���� ���̴�.
# cat /etc/syslog.conf
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none /var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
# Log all the mail messages in one place.
mail.* /var/log/maillog
# Everybody gets emergency messages, plus log them on another
# machine.
*.emerg *
# Save mail and news errors of level err and higher in a
# special file.
uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
�������� �ſ� �����ϴ�. �� �� # ���� ��۵Ǵ� �� ���õȴ�.
(���� �������� BSD ������ �α� �����Ѵ�)
������� ������ ����� ����.
facility.level destination
facility�� ����� ������ ����ý���� �̸��̸�
level(priority)�� ����� �߿伺(���ݵ�)�� ��Ÿ����.
facility�� ����� ����.
auth, authpriv, cron, daemon, kern, lpr, mail, news, syslog,
user, uucp, local0 - local7
priority�� ����� ����. (���ݵ��� �����ϴ� ����)
debug, info, notice, warning, warn (same as warning),
err, error (same as err), crit, alert, emerg,
panic (same as emerg)
���ڿ� ���� ���� �Ʒ��� ������.
# man 3 syslog
facility
The facility argument is used to specify what type of pro
gram is logging the message. This lets the configuration
file specify that messages from different facilities will
be handled differently.
LOG_AUTH
security/authorization messages (DEPRECATED Use
LOG_AUTHPRIV instead)
LOG_AUTHPRIV
security/authorization messages (private)
LOG_CRON
clock daemon (cron and at)
LOG_DAEMON
other system daemons
LOG_KERN
kernel messages
LOG_LOCAL0 through LOG_LOCAL7
reserved for local use
LOG_LPR
line printer subsystem
LOG_MAIL
mail subsystem
LOG_NEWS
USENET news subsystem
LOG_SYSLOG
messages generated internally by syslogd
LOG_USER(default)
generic user-level messages
LOG_UUCP
UUCP subsystem
level
This determines the importance of the message. The levels
are, in order of decreasing importance:
LOG_EMERG
system is unusable
LOG_ALERT
action must be taken immediately
LOG_CRIT
critical conditions
LOG_ERR
error conditions
LOG_WARNING
warning conditions
LOG_NOTICE
normal, but significant, condition
LOG_INFO
informational message
LOG_DEBUG
debug-level message
auth ��� auth_priv�� ����� ��� ��õ�ϰ� ����� �������
�о�� ���� ���ذ� �� ��̴�. ũ��, ���, Ŀ�� ���,
���ÿ��� ���, �����, ���, ����, syslog, ���� ����,
UUCP. (auth�� �α�� ��� �ý���)
emerg : �ý��� �д�
alert : ���� ���. �ﰢ �˷����� ����
crit : �ϵ� ��ġ ������ ���� �Ӱ� ����(critical error)
err : ����
warn : ���
notice : ��Ӱ� ���
info : ���� ���
debug :���� ����� ���� Ư�� ����
���� none �̶�� �ϸ� �� ���� ��� �α� ����� �����϶�� ��Դϴ�.
��� facility �� priority �� �����Ϸ��� * �� ���� �Ǹ�
�������� �����Ϸ��� , �� ����ϸ� �˴ϴ�.
���� ���⼭ �ݵ�� �˾Ƶξ��Ұ�� priority�� �����ϸ� ��
���� priority���� �� ���� priority�� ���õ� �α� ����Ѵٴ�
��Դϴ�. ���� info �� �����ϸ� emerg ���� info ���� ���
�α� ����ϴ� ������.
���� ����� priority�� �����Ϸ��� = �� ����ϸ� �˴ϴ�.
!�� priority ������ �����մϴ�.
�̿� ���ؼ��� �Ʒ����� �����ϴ� ���� ����ϼ���.
** ���������� syslogd�� ���� BSD �ҽ��� ��� ���� �߰�
�Ǿ���. =, ! ��� �̿� ���Ѵ�.
�α����� ������ ����� ��Ŀ��� ���������� �ִ�.
���� ��� ������(/var/log/messages). named pipe.
�̳ΰ� �ܼ�(/dev/console). ���� �ӽ�(@). ����.
�α���� ��ü ����(*)
�� ���� ��� /etc/syslog.conf �� ���캸��.
# cat /etc/syslog.conf
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
kern.* /dev/console
# ��� Ŀ�� ����� �ַܼ�.
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none /var/log/messages
# ��� info�� messages�� ���. ���⼭ mail, authpriv ���� ���� ����
# The authpriv file has restricted access.
authpriv.* /var/log/secure
# ��� �� ��� ���� ���. su, login �� ��� ���� ���
# Log all the mail messages in one place.
mail.* /var/log/maillog
# ��� ��� ���
# Everybody gets emergency messages, plus log them on another
# machine.
*.emerg *
# ��� ���(emerg)�� ��� �α���� ��� ���ڿ��� �˸�
# Save mail and news errors of level err and higher in a
# special file.
uucp,news.crit /var/log/spooler
# uucp, news �� crit ���� ���
# Save boot messages also to boot.log
local7.* /var/log/boot.log
# ��Ʈ ��� ���
���� ���� ����� �Ϲ���� ����� �����̴�.
�Ƹ� kernel ������� �ּ��� �Ǿ��� ��̴�.
���� ��� *.err /dev/tty8 �� �߰��غ���.
���ִ� tty8 �ֿܼ��� �ý��ۿ��� ���ϴ� ���
������ �� �� �ִ�.
*.* @taejun
�̰� ��� ����� taejun �̶�� ���� ȣ��Ʈ���� ó���ϵ���
�� �� �ִ�. � ��� �̰� �����ұ�? �̰� Ŭ���������� ������
�ý��ۿ��� ��� ������ ��̴�. ��� syslog ����� �Ѵ��
�ý������ �� �� ����ϱ�.
���� ���� �⺻ �������� ��� ���� �� ����.
# Store critical stuff in critical
#
*.=crit;kern.none /var/adm/critical
# Ŀ��� �����ϰ� ��� crit �� �ش��ϴ� ��� ���
# (���⼭ = �� ������ ������ ���ؼ� �����ؾ���)
# Kernel messages are first, stored in the kernel
# file, critical messages and higher ones also go
# to another host and to the console
#
kern.* /var/adm/kernel
kern.crit @finlandia
kern.crit /dev/console
kern.info;kern.!err /var/adm/kernel-info
# Ŀ�� ���� ��� ���� kernel ��Ͽ�,
# Ŀ�ο��� crit �̻�� ����´� �ְܼ� ���� ȣ��Ʈ��.
# �ι�° �κ�(���� ȣ��Ʈ)�� ������ ��� ���� �ý����
# �ر��ؼ� ��ũ���� ������ �� ���� ������ ������
# ���� ȣ��Ʈ���� �� ������ �ذ��� �� �ִ� �����
# ã�� �� �ִ�.
# ��� ��° ��. �̰� info ���� err ��� ���ϱ�
# info , notice, warn �� ���� ����� ����Ѵ�.
# �α� ������ �����ϴ� ������.
# The tcp wrapper loggs with mail.info, we display
# all the connections on tty12
#
mail.=info /dev/tty12
# mail.info�� ���õ� ����� 12��° �ֿܼ� ���.
# Store all mail concerning stuff in a file
#
mail.*;mail.!=info /var/adm/mail
# mail.info �� �����ϰ� ��� mail ���.
# Log all mail.info and news.info messages to info
#
mail,news.=info /var/adm/info
# mail �� news�� info �� ���
# Log info and notice messages to messages file
#
*.=info;*.=notice;\
mail.none /var/log/messages
# info �� notice �� �ش��ϴ� ��� ��� ���.
# ���⼭ mail�� ��� ����� ����.
# Log info messages to messages file
#
*.=info;\
mail,news.none /var/log/messages
# ��� info �� ���õ� ���.
# ��, ���, ������ ��� ����� ����
# Emergency messages will be displayed using wall
#
*.=emerg *
# ��� emergency ������ ��� �α���� ��� ���ڿ���.
# �̴� wall �� ����.
# Messages of the priority alert will be directed
# to the operator
#
*.alert root,taejun
# ��� alert �̻� ����� root �� taejun ���ڿ���
*.* @taejun
# ��� ����� taejun �̶�� ���� ȣ��Ʈ��
# ������ �����ߴ� ��ó�� Ŭ������ �ý��ۿ���
# �� �α� ����� �Ѱ��� ����ϴ� ��� ����
logger ��ƿ��Ƽ�� �� ��ũ��Ʈ���� syslog ���� �̿�
����� ���� �� �ִ�.
# logger -p authpriv.alert -t oh_no_login \
"���̰� �̻��� ������ �α���߾��... ���� �̷�~~"
# tail -f secure
Feb 22 18:31:42 taejun oh_no_login: ���̰� �̻��� ������
�α���߾��... ���� �̷�~~
�� ��ġ�� �������????
���� /var/log/wtmp �� �̿�, last ������
����� �α�ΰ� ���õ� ���� �� �� �ִ�.
�� ������Ͽ��� /var/log/�� �ִ� �α���Ͽ� ���ؼ�
������ ���� �� �Ͽ���. ���⼭ ������ ��� ���
xferlog �ε� �̴� ftp ������ ���� �α����̴�.
�� ���� ���� �ڽ�� ������ �´� �α� ���� �����غ���.
2. logrotate �̿��� �α� ��� ����
�������� ���� �Ѵ�� �α����� ����� ������� �����
��� ������ ��� �α���϶����� �ϵ��ũ ������ ���Ƴ���
�ʰ� �� �α���� ó���� �����Ÿ��� �ȴ�.
��κ� ������ ���� ����ǿ����� �⺻���� ��ġ�Ǿ� �ִ�.
# rpm -qa | grep logrotate
logrotate-3.3-1
# rpm -ql logrotate
/etc/cron.daily/logrotate
/etc/logrotate.conf
/etc/logrotate.d
/usr/man/man8/logrotate.8
/usr/sbin/logrotate
logrotate�� ��� Ŀ���� �α����� ȿ��������
�����ϱ� ���� ��α��̴�.
�ڵ����� ����̼�� ����ְ�, ����, ����, ��Ϸ� �����ֱ� ���
�۾��� �Ѵ�.
�ʱ� ������ ��ġ�� �ڵ����� cron�� �߰��� �ȴ�.
/etc/cron.daily/logrotate
���� ����� ����.
# cat /etc/cron.daily/logrotate
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
������ ���� logrotate �� ��α��̰� logrotate.conf��
�������̶�� ��� �� �� ��� ��̴�.
������ .conf ��ϴ�� Ư�� ���丮�� �����ϸ�
�� �ش� ���丮�� ��� ���� ����� �۾��� �Ѵ�.
logrotate �� �������� �ɼ�� ����� �״�� ����� ���
���� �� ����. Ȥ�ó� �ñ��ϸ� man ���� Ȯ��.
��� rotate �� ���ؼ� �����ϰڴ�.
rotate 3 ��� cron �� ��� ���.
/var/log ���丮�� cron�� ���� ó�� �����ǰ�
��ȯ���ݸ��� ���� cron �� cron.1 ��, cron.1�� cron.2,
cron.2 �� cron.3 ���� �ȴ�. ���� cron.3�� ���� �� ��̴�.
���ϱ� ���� ������ ��Ϸαܿ� ����� �α� 3���� ���
�ϴ� ��̴�.
�� ���� ��� �������� �ѹ� ���캸��.
# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly
# �⺻������ ���ϸ��� �α����� ��ȯ��Ŵ
# keep 4 weeks worth of backlogs
rotate 4
# ��� �α����� 4�ֵ��� ����.
# ������ ��ȯ����� 1��Ϸ� ����Ƿ�.
# send errors to root
errors root
# ������ ������ root ���� ��Ϸ�.
# create new (empty) log files after rotating old ones
create
# ���� �α����� ��ȯ��Ų�� ���ο� �α���� ����
# uncomment this if you want your log files compressed
#compress
# gzip �� �̿� �����Ѵ�.
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# /etc/logrotate.d ��� �Ǵ� ���丮 �ȿ� �ִ� ���� �о��δ�.
# ���� ���� �������� ����� ���� �⺻���� ���� �ִ�.
# ls /etc/logrotate.d
# apache cron ftpd named samba squid syslog
# ���⼭ ���� �߿��� syslog�� messages, secure, maillog, spooler,
# bootlog �� ����
# no packages own lastlog or wtmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}
# �ſ����� ��ȯ��Ŵ
# create �� ��ȯ�� ��� (postrotate ��ũ��Ʈ�� �����Ű����)
# �α� ���� �����Ѵ�. �ڿ��� ������ ������ postrotate��
# �α����� ��ȯ���� ������ �۾��� ����Ѵ�.
# 0664 �� �����ϴ� ���� �㰡��, root �� �����, utmp �� ��
# rotate 1 �� ������ �����ߴ�. ���� ���������� �����ϸ�
# �ʱ ������ weekly �� ���õ� ���� ������ ������
# ���Ƿ� ������� ����� �α����� 1���� ������̴�.
# (���� ����)
# ���� �⺻������ syslog������ 600���� �㰡��� �����Ѵ�.
# �ٸ� ������ �α���Ͽ� �����ϸ� �ȵDZ� �����̴�.
/var/log/lastlog {
monthly
rotate 1
}
# system-specific logs may be configured here
��� ��� �ֿ��� �ɼǿ� ���ؼ� ���캸��.
�� ��ȯ�� �Ⱓ ���� : daily, weekly, monthly ��
��� size �� �̿��� ũ��� ������ �� �ִ�.
����� ���Ƽ� �α����� ��û���� �þ�� ��쿡��
size(�⺻ kilobytes)�� �̿� �����ؾ� �� ��̴�.
size 100k(= size 100)
�� ���༳�� : compress
gzip���� ��� �α����� �����Ѵ�.
������ ������ �� �ִ�.
�� �ɼ�� ���ַ��� �ּ��� �� �ƴϸ�
nocompress(�⺻��) ���
�� ��ϼ��� : error, mail
error taejun -> ������ taejun �̶�� ���ڿ��� ����
mail taejun -> �α����� ��ȯ��Ű�� ���߿� ���ؾ��Ҷ�
����� �ʰ� ��Ϸ� ������ ��̴�.
�� ���� ����
create mode owner group (�⺻��)
������ ��뿹�� �����ߴ�. create �� �����ϸ� ��ȯ�� �α�
���� �����Ѵ�. �ݴ�� nocreate
�� ��ȯ���� : rotate count
��� �α����� ���ǰų� ��Ϸ� �������� ��ȯ�� ��
Ƚ�� ����. ���⼭ 0���� �����ϸ� ���� �α�����
������ ���ȴ�.
�� ������ ����� ���� ��� : missingok, nomissingok
�α����� ������ �⺻�� ������ ����(nomissingok, �⺻��).
missingok �� �����ϸ� ������ ������ ������ �ʴ´�.
�� ����� ����� ���� ���(��������)
�⺻�� ifempty�� ����� �� ��ȯ�� �Ѵ�.
��ȯ�� ��� �ʵ��� �Ϸ��� notifempty �� �����ϸ� �ȴ�.
�� ��ȯ�� �۾� : postrotate/endscript
��ȯ�ϱ� �۾��� �Ϸ��� prerotate/endscript
�� ����Ѵ�. �Ϲ�����δ� ��ȯ�� �۾��� �� ��̴�.
���� ��� ��ϰ��� �α� ���� ��������� syslogd��
�ٽ� �������Ѿ� �� ��̴�. �̷��͵� �����Ѵ�.
�� ��� �Ǵ� ���丮 ��� : include
�ٸ� ���̳� ���丮��� ���� ����� ���
�� �̿� ���� ���� ���� ���� �α� �����غ���.
���⼭�� /etc/logrotate.d/syslog ���� ��ϼ�����
�α� ���� ó���� �غ��ڴ�.
# vi /etc/logrotate.d/maillog
weekly
size 500k
rotate 4
compress
errors admin
mail admin
nomissingok
create 0644 root root
/var/log/maillog {
postrotate
/usr/bin/killall -HUP syslogd
endscript
}
/var/log/messages {
postrotate
/usr/bin/killall -HUP syslogd
endscript
}
���� ������ �׳� ���� ���� ��̹Ƿ� ������ �ʿ�� ����.
��ָ��� �ѹ��� ��ȯ��Ű�� ũ�Ⱑ 500k�� ��� �ʵ��� �ϸ�
��ȯ�� ���� ���� �Ѵ�. ������ admin �̶�� ���ڿ���
������ ��ȯ�� ���� ���� ��Ϸ� admin ���� ������.
���� �α����� ������ ������ ���� ��ȯ�� ���� ������Ű��
�� ���� ���� 0644 �� ����ڿ� �� root �� �Ѵ�.
����� �Ը� ���� �α����� ��ȯ�� �ֱ⸦ �� ª�� ��ƾ�
�Ѵ�. ũ�⸦ �����ϴ°�� ������� ȿ������ ��̴�.
3. ��ġ��
����� �о��ٸ� �뷫 �ý���� �αװ� ��� �ۼ��ǰ�
��� ������ �ؾ���� ���� ���� ��̴�.
�ý���� ���ڴٴ� ��� ſ��� ���� �����ڰ� ��
�ý���� ���¸� �ֱ����� �����ϰ� ���ȭ�ϴ����
�߿��ϴ�.
### ��� : ���� �α� �ٸ� ȣ��Ʈ�� ����ϱ�
Ŭ������ �ý���� �����ϴ� ��� ���� ������ �αװ� �������ϴ�.
�̷� ��� �߾�� �����ڿ� ������ �α� ���߽�ų �� �ֽ��ϴ�.
1. ��� Ȯ���ؾ� �� ��
/etc/services
syslog 514/udp
�α� ����� �ʰ� �� �� �α������� �� �ʿ��մϴ�.
���� �⺻ �����Ǿ��� ��Դϴ�.
����� �ְ�µ� UDP �Ʈ�� �ʿ��ϱ� �����Դϴ�.
2. �α� �ۼ��ϴ� �������� �ʿ��� ����.
/etc/syslog.conf
mail.info @admin
�̰� mail.info �� �ش��ϴ� �α� admin �̶�� ȣ��Ʈ�� ������ ��Դϴ�.
�̿�̸� admin�� DNS�� ������ ���� ���� ����Ƿ� /etc/hosts�� �����
�δ� ��� ���� ��Դϴ�.
�ʿ��ϴٸ� *.* �� �̿� ���θ� �� ���� ���� �ְ����.
�̰� ������ ���ĸ� �ý���� ���� ������ ���� ȣ��Ʈ���� �α� ����
�����Ƿ� ���߿� �м��� �� �� �ִٴ� ��Դϴ�.
3. �α� �� �������� �ʿ��� ����
syslogd ��� ����Ҷ� �߰� �ɼ�� �ʿ��մϴ�.
������� ��� ������� ����� ���� ���� ��Դϴ�.
/etc/rc.d/init.d/syslog
���⼭ ��� ����ϴ� �ɼ����
daemon syslogd -m 0 -r -h
�̷��� ��� �մϴ�.
-m 0 : �⺻�����Ǿ�ִ°���� ������� �ʾƵ� �˴ϴ�. �̰� ������ �е��ȿ�
MARK ��� �α���Ͽ� ���� �մϴ�. 0�̸� ���� ��� �ʴ� ������.
-r : ���ͳ� ����� ����� �̿��� ��Ʈ������ ����� �� �ɼ�
-h : �⺻������ syslogd�� ���� ȣ��Ʈ���� ��� ����� �α� ������ �������
�ʽ��ϴ�. �� �ɼ�� ����Ͽ� ���� ȣ��Ʈ���� ��� �α����� �����մϴ�.
(����̶� ��� ��� �α� ��Ͽ� ����Ѵٰ� �����ϸ� �˴ϴ�)
man syslogd �� �غ��� ���� �� �� �ֽ��ϴ�.
syslogd�� ����� ���� ���� ��Ű���� �ֽ��ϴ�.
http://www.core-sdi.com/english/freesoft.htm
secure system logging tool �Դϴ�.
���� �����ϴ� ��� ���� ��������̱���.
������Ͽ� ��ġ�ϴ� ��̴ϱ� ����� ��ġ�� ��̶� ����dz�