·Î±×ÆÄÀÏ Á¾·ù...
±Û   ¾´   ÀÌ linux
³¯         Â¥ 2003³â 01¿ù 02ÀÏ 17½Ã 34ºÐ 34ÃÊ
º»         ¹® ¸®´ª½º ·Î±× ÆÄÀÏ¿¡ ´ëÇØ
¸®´ª½º¼­¹ö´Â ´Ù¾çÇÑ ·Î±× ÆÄÀÏÀÌ »ý±â°í ÀÖÀ¸¸é °ü¸®ÀÚ°¡ µÇ¾ú´Ù¸é ÀÌ ·Î±× ÆÄÀÏ¿¡ ´ëÇÑ Ã³¸®(¹é¾÷,»èÁ¦)¿Í Á¤¸®¸¦ ÇØ¾ß ÇÒ °ÍÀÌ´Ù.
¸®´ª½º ½Ã½ºÅÛÀº /var/log µð·ºÅ丮 ·Î±× ÆÄÀÏÀÌ ÀÖÀ¸¸é ÀÌ°÷¿¡ ´Ù¾çÇÑ ·Î±× ÆÄÀÏÀÌ ÀúÁ¤ÀÌ µÈ´Ù.( ¼Ò½º·Î ÇÁ·Î±×·¥ ¼³Ä¡½Ã ´Ù¸¥ µð·ºÅ丮¿¡ ·Î±× ÆÄÀÏÀÌ »ý±ä´Ù.¿¹·Î ¾ÆÆÄÄ¡¸¦ ¼Ò½º·Î ¼³Ä¡¸¦ ÇÏ¿´´Ù¸é /usr/local/apache/logs µð·ºÅ丮¿¡ ·Î±×ÆÄÀÏÀÌ »ý±ä´Ù.)
[root@server mail]# cd /var/log/
[root@server log]# ls -al
total 5572
drwxr-xr-x 2 root root 4096 2¿ù 25 04:02 ./
drwxr-xr-x 17 root root 4096 9¿ù 22 11:50 ../
-rw-r--r-- 1 root root 262 2¿ù 25 10:19 boot.log
-rw-r--r-- 1 root root 7711 2¿ù 26 00:30 cron
-rw-r--r-- 1 root root 18679 2¿ù 25 04:02 cron.1
-rw-r--r-- 1 root root 7188 12¿ù 3 02:27 dmesg
-rw-r--r-- 1 root root 0 10¿ù 22 17:39 htmlaccess.log
-rw-r--r-- 1 root root 522930 2¿ù 26 00:30 maillog
-rw-r--r-- 1 root root 196796 2¿ù 26 00:37 messages
-rw-r--r-- 1 root root 0 2¿ù 1 04:02 netconf.log
-rw------- 1 root mail 3947393 2¿ù 26 00:30 procmail
-rw-r--r-- 1 root root 33512 2¿ù 26 00:07 secure
-rw-r--r-- 1 root root 0 2¿ù 24 04:02 spooler
-rw-rw-r-- 1 root utmp 494976 2¿ù 26 00:37 wtmp
-rw-r--r-- 1 root nobody 55397 2¿ù 25 22:50 xferlog
-rw-r--r-- 1 root nobody 367791 2¿ù 24 21:52 xferlog.1
[root@server log]#
boot.log
cron : cron °ü·Ã ·Î±× ÆÄÀÏ
dmesg : ½Ã½ºÅÛ °ü·Ã ·Î±× ÆÄÀÏ
htmlaccess.log : linuxconf ¸¦ À¥¿¡¼­ Á¢¼ÓÇ߸¦¶§ ·Î±× ÆÄÀÏ
maillog : ¼ö½Å ¸ÞÀÏ ·Î±×
srcure : ¿ø°Ý Á¢¼ÓÇÑ ¸ðµç ·Î±×ÆÄÀÏ
wtmp : Á¢¼Ó ½Ã°£ ip ip ±â·ÏÀÌ ÀÖÀ¸¸é last ¸í·É·Î·Î¸¸ º¼ ¼ö ÀÖ´Ù.
xferlog : ÆÄÀÏ Àü¼Û °ü·Ã ·Î±× ÆÄÀÏ

·Î±× ±â·Ï µ¥¸ó
[root@server log]# ps -aux | grep log
root 10662 0.0 0.2 1248 608 ? S Feb21 0:05 syslogd -m 0
root 10671 0.0 0.3 1516 828 ? S Feb21 0:00 klogd
syslogd ¿Í klogd ÀÌ µÎ°³ÀÇ µ¥¸óÀÌ ·Î±× ÆÄÀÏÀ» »ý¼ºÀ» ÇØ ÁØ´Ù.
syslogd ÀÇ ¼³Á¤ ÆÄÀÏÀº /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
#

# ·¹º§ÀÇ ÀǹÌ

# debug ÇÁ·Î±×·¥ µð¹ö±ëÇÒ ¶§ ¹ß»ýÇÏ´Â ¸Þ¼¼Áö
# info Åë°è,±âº»Á¤º¸¸Þ½ÃÁö
# notice Åë°è ±âº» Á¤º¸ ¸Þ½ÃÁö
# warming ÁÖÀǸ¦ ¿äÇÏ´Â °æ°í ¸Þ½ÃÁö
# err ¿¡·¯°¡ ¹ß»ýÇÏ´Â °æ¿ìÀÇ ¸Þ¼¼Áö
# crit ±ÞÇÏÁö ¾ÊÁö¸¸ ½Ã½ºÅÛ¿¡ ¹®Á¦°¡ »ý±â´Â ´Ü°èÀÇ ¸Þ½ÃÁö
# elert Áï°¢ÀûÀÎ Á¶Á¤À» ÇØ ÁÖ¾î¾ß ÇÏ´Â »óȲ
# emerg ¸ðµç »ç¿ëÀڵ鿡°Ô Àü´ÞµÇ¾î¾ß ÇÏ´Â À§ÇèÇÑ »óȲ

ÀÌ·¸°Ô »ý±ä ·Î±× ÆÄÀÏ»ý±â´Âµ¥ ·Î±× ÆÄÀÏÀº ¿ë·®ÀÌ ¸¹ÀÌ Â÷±â Çϱ⠶§¹®¿¡ ·Î±× ÆÄÀÏÀ» ³ª¿ì¾î¼­ °ü¸® ÇÒ ¼ö ÀÖ´Â ÇÁ·Î±×·¥ÀÌ ¼³Ä¡ µÇ¾î ÀÛµ¿À» ÇÏ°í Àִµ¥ ÀÌ°ÍÀÌ
logrotate ÀÌ´Ù.

ÀÌ ÇÁ·Î±×·¥Àº cron ¿¡ ÀÇÇØ ÀÛµ¿À» Çϴµ¥ ¸ÅÀÏ ÀÛµ¿À» Çϸ鼭 ·Î±× ÆÄÀÏÀÌ ³ª´©¾î ÁØ´Ù.

[root@server /etc]# cd /etc/cron.daily/
[root@server cron.daily]# cat logrotate
#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
/etc/cron.daily µð·ºÅ丮 ¾È¿¡ ÀÖ´Â ÆÄÀÏÀº ¸ÞÀÏ 4½Ã 04 ºÐ¿¡ ½ÇÇàÀÌ µÇ¸ç
ÀÌÁß logrotate ½ºÅ©¸³Æ®°¡ ½ÇÇàµÇ¾î ·Î±× ÆÄÀÏÀ» ³ª´©´Â ¿ªÈ°À» ÇÑ´Ù.

½ÇÇà ÆÄÀÏ À§Ä¡ : /usr/sbin/logrotate
¼³Á¤ ÆÄÀÏ : /etc/logroate.conf

# see "man logrotate" for details
# rotate log files weekly
weekly
# ·Î±× ÆÄÀÏÀ» ÁÖÀÏ ´ÜÀ§·Î ÀÚ¸£°Ú´Ù
# ÀÌ ¼³Á¤Àº daily , weekly , monthly ,size
# ´ÜÀ§·Î ¼³Á¤À» º¯°æÀ» ÇÒ ¼ö ÀÖ´Ù.
# keep 4 weeks worth of backlogs
rotate 4
# ·Î±×ÆÄÀÏÀ» 4°¡Áö´Â ³ª´©°í ±× ÀÌ»óÀÌ µÇ¸é Áö¿î´Ù.
# ·Î±× ÆÄÀÏÀÌ Áß¿äÇÏÁö ¾Ê´Ù¸é 1-2°³·Î ÁÙ¿© Á־ µÈ´Ù.
# 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
# ·Î±× ÆÄÀÏÀ» ¾ÐÃàÀ» ÇÒ·Á¸é ÁÖ¼®À» Áö¿ì¸é µÇ´Âµ¥ º¸Åë ¾ÐÃàÇÏÁö
# ¾Ê´Â´Ù. nocompress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# °¢°¢¿¡ ·Î±× ÆÄÀÏÀ» ³ª´©´Â ½ºÅ©¸³Æ®°¡ ÀÖ´Â °÷ÀÌ´Ù.
# ÀÌ·¸°Ô µÇ¾î ÀÖ´Â ÀÌÀ¯´Â µ¥¸ó °ü·Ã ·Î±×´Â ·Î±× ÆÄÀÏÀ» ÀÓÀÇÀûÀ¸·Î
# »ý¼ºÀ» ÇÏ¸é ·Î±× ÆÄÀÏÀÌ »ý±â±â ¾Ê±â ¶§¹®¿¡ µ¥¸óÀ» µ¥¸óÀ» Àç½ÃÀÛÇؾß
# ÇÏ´Â ¹æ½ÄÀ¸·Î »õ·Î¿î ·Î±× ÆÄÀÏÀ» ¸¸µç´Ù.

# no packages own lastlog or wtmp -- we'll rotate them here

/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}
#wtmp ·Î±× ÆÄÀÏÀº Á÷Á¢ÀûÀ¸·Î »ý¼º(create) ÇØ·Î µÇ±â ¶§¹®¿¡
#ÀÌ°÷¿¡ ÀÖÀ¸¸é monthly °¡ ÀÖ¾î ¿ù ´ÜÀ§·Î ÀÛµ¿À» ÇÏ°í ·Î±× ÆÄÀÏÀ»
# wtmp.1 ±îÁö¸¸ ¸¸µç´Ù.
# system-specific logs may be configured here


root@server /etc]# cd /etc/logrotate.d
[root@server logrotate.d]# ls
cron named syslog
[root@server logrotate.d]#
root@server /logroate.d]# cat proftpd

/var/log/xferlog {
missingok
nocompress
postrotate
/usr/bin/killall -HUP proftpd > /dev/null 2>&1
endscript
}
# ftp °ü·Ã ·Î±× ÆÄÀÏÀÌ xferlog À» ³ª´« ÆÄÀÏÀÌ´Ù.


°ü·Ã °Ô½Ã¹° : 1 (Total 1 Articles)
¹ø È£ Á¦ ¸ñ ±Û¾´ÀÌ ÀÛ¼ºÀÏ Á¶È¸¼ö ¼± ÅÃ
1  ·Î±×ÆÄÀÏ Á¾·ù... linux03-01-02413