[Ubuntu] logrotate

2022. 11. 2. 17:01ใ†System ์ž‘์—…์‹ค/LINUX

728x90
๋ฐ˜์‘ํ˜•

 

 

[ํ•œ๋น›๋ฏธ๋””์–ด]์ด๊ฒƒ์ด ์šฐ๋ถ„ํˆฌ ๋ฆฌ๋ˆ…์Šค๋‹ค : ์šฐ๋ถ„ํˆฌ ๋ฆฌ๋ˆ…์Šค ์„ค์น˜๋ถ€ํ„ฐ ๋„คํŠธ์›Œํฌ์™€ ์„œ๋ฒ„ ๊ตฌ์ถ• ์šด์˜๊นŒ์ง€

COUPANG

www.coupang.com

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 

 

 

 

 

๐Ÿš€ Linux Log ๊ด€๋ฆฌ

    ๐Ÿ”ฝ  ์†Œ๊ฐœ

        ๐Ÿ“ฆ ๊ฐœ์š”

Log๋Š” ์–ด๋–ค System์„ ๊ด€๋ฆฌํ•  ๋•Œ, ๋งค์šฐ ์ค‘์š”ํ•œ ์ •๋ณด๋ฅผ ๋‹ด๊ณ  ์žˆ๋Š” File์ด์—์š”.

Linux์—์„œ Program ์ˆ˜ํ–‰ ๋“ฑ์„ ํ•  ๋•Œ, Error ํ˜น์€ ์ˆ˜ํ–‰ ๊ฒฐ๊ณผ ๋“ฑ์„ Log๋กœ ๋‚จ๊ธฐ๊ฒŒ ๋˜๋ฉด Error๊ฐ€ ๋ฐœ์ƒํ•œ ์ด์œ ์— ๋Œ€ํ•ด ๊ด€๋ฆฌ์ž๋Š” ์–ด๋–ค ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ๊ณ , ๊ทธ ๋Œ€์ฒ˜ ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ๊ณ ๋ฏผํ•ด ๋ณผ ์ˆ˜ ์žˆ๋Š” ์•„์ฃผ ์ค‘์š”ํ•œ ๋‹จ์„œ๊ฐ€ ๋  ๊ฒƒ์ด์—์š”.

์ฃผ๋‹ˆํ•˜๋ž‘์€ ๊ฐœ๋ฐœ Side Project๋ฅผ ์œ„ํ•ด ์—ฌ๋Ÿฌ System์„ ๊ตฌ์ถ•ํ•˜์˜€๋Š”๋ฐ, ๊ทธ ์ค‘ Project Management๋ฅผ ์œ„ํ•ด Redmine์„ ๊ตฌ์ถ•ํ•˜์˜€์–ด์š”.

Redmine์„ ํ†ตํ•ด Side Project์—์„œ ๋‚˜์˜ค๋Š” ์‚ฐ์ถœ๋ฌผ ์ค‘ ํ•˜๋‚˜์ธ Source Code๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด Github ๋“ฑ์—์„œ Clone์„ ๋– ์„œ Redmine์— ์ €์žฅํ•˜๊ณ , ์ด๋ฅผ ์ถœ๋ ฅํ•ด ์ฃผ๋Š” ์ž‘์—…์ด ํ•„์š”ํ•œ๋ฐ, ์ด ๋•Œ Cron์„ ์ด์šฉํ•ด์„œ ์ฃผ๊ธฐ์ ์œผ๋กœ GitHub ๋“ฑ์— Source Code๋ฅผ ๊ฐ€์ ธ์˜ค๋„๋ก ์„ค์ •ํ•ด ๋‘์—ˆ์–ด์š”.

์ด ๋ถ€๋ถ„์— ๋Œ€ํ•ด ๊ถ๊ธˆํ•˜์‹  ๋ถ„๋“ค์„ ์œ„ํ•ด ์ด ๊ณณ์— ํ•ด๋‹น ๋‚ด์šฉ์„ ์ •์„ฑ์Šค๋Ÿฝ๊ฒŒ ์ค€๋น„ํ•œ ๊ฒƒ์ด์—์š”.

์ฃผ๋‹ˆํ•˜๋ž‘์€ cron์„ ํ†ตํ•ด ์ฃผ๊ธฐ์ ์ธ ์ž‘์—…์„ ํ•  ๋•Œ, ์–ด๋–ค ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”์ง€ Log์— ๋‚จ๊ธฐ๊ณ  ์‹ถ์—ˆ์–ด์š”.


๊ทธ๋ž˜์„œ ์œ„์™€ ๊ฐ™์ด cron์ด ๋™์ž‘ํ•˜๊ฒŒ ๋˜๋ฉด Log๊ฐ€ ๋‚จ๋„๋ก ์ž‘์—…ํ•œ ๊ฒƒ์ด์—์š”.

crontab -l


ํ•˜์ง€๋งŒ ์œ„์™€ ๊ฐ™์ด ์„ค์ •์„ ํ•˜๊ณ  ๊ณ ๋ฏผ์ด ์ƒ๊ฒผ์–ด์š”.

์œ„์™€ ๊ฐ™์ด Cron ์ž‘์—…์„ ๋งค ๋ถ„๋งˆ๋‹ค ์ž‘์—…ํ•˜๋„๋ก ํ•˜์˜€๋Š”๋ฐ, ์ด๋ ‡๊ฒŒ ๋˜๋ฉด Log๋Š” ์—„์ฒญ๋‚˜๊ฒŒ ์Œ“์ผ๊ฑฐ๊ณ , ์ฃผ๊ธฐ์ ์œผ๋กœ ๊ด€๋ฆฌ๋ฅผ ํ•ด์ฃผ์ง€ ์•Š๋Š”๋‹ค๋ฉด Storage์— ์šฉ๋Ÿ‰์ด ๊ฐ€๋“์ฐจ์„œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ๊ฒƒ์ด๋ผ๋Š” ๊ฑฐ์—์š”.

๊ทธ๋ž˜์„œ ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด Logratae(๋กœ๊ทธ ๋กœํ…Œ์ดํŠธ)๋ฅผ ์ด์šฉํ•ด์„œ Log๋ฅผ ๊ด€๋ฆฌํ•˜๋ฉด ์ข‹๊ฒ ๋‹ค ๋ผ๋Š” ์ƒ๊ฐ์„ ํ•œ ๊ฒƒ์ด์—์š”.



Logrotate๋Š” ์•„๋ž˜ ์ˆœ์„œ๋กœ ๊ตฌ๋™์ด ๋˜์š”.

logrotate ์‹คํ–‰ ์ˆœ์„œ

 

 

 

 

 

        ๐Ÿ“ฆ Logrotate๋ž€?

Logrotate๋Š” Linux์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” Log Management Program์ด์—์š”.
Logrotate๋ฅผ ์ด์šฉํ•˜๋ฉด ํŠน์ • Directory์— ์Œ“์ด๋Š” Log๋ฅผ ์›ํ•˜๋Š”๋Œ€๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๊ณ , ์–ด๋–ค ๊ธฐ์ค€์„ ์ •ํ•˜๋ฉด ํ•ด๋‹น์ผ ์ด ์ „ Log๋ฅผ ์ž๋™์œผ๋กœ ์‚ญ์ œํ•˜์—ฌ System ์šฉ๋Ÿ‰ ๋‚ญ๋น„๋ฅผ ๋ง‰์„ ์ˆ˜ ์žˆ์–ด์š”.

 

 

 

 

        ๐Ÿ“ฆ Logrotate ๊ตฌ์กฐ / ์„ค์ •๋ฒ•

/etc/logrotate.conf : Logrotate ๊ธฐ๋ณธ ์„ค์ • File
/etc/logrotate.d : Logrotate ๊ฐœ๋ณ„ ์„ค์ • ํŒŒ์ผ Directory (Logrotate Deamon Config File)
/usr/sbin/logrotate : Logrotate Deamon
/etc/cron.daily/logrotate : Logrotate ์ž‘์—… ๋‚ด์—ญ Log



 

 

 

 

    ๐Ÿ”ฝ  ์‹œ์ž‘ํ•˜๊ธฐ

        ๐Ÿ“ฆ ์„ค์น˜

์ฃผ๋‹ˆํ•˜๋ž‘์˜ Redmine์€ Synology NAS์— Docker๋ฅผ ์ด์šฉํ•ด์„œ Redmine Container๋กœ ๊ตฌ์ถ•์„ ํ•ด ๋‘์—ˆ์–ด์š”.
ํ•ด๋‹น Container์— OS๋Š” Ubuntu์ด๊ณ , Ubuntu Linux์— ๋งž๊ฒŒ Logrotate๋ฅผ ์„ค์น˜ํ•ด ๋ณด๋„๋ก ํ• ๊ฒŒ์š”.

apt-get install -y logrotate

728x90


์œ„์™€ ๊ฐ™์ด apt ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด logrotate๋ฅผ ์„ค์น˜ํ•ด ์ค๋‹ˆ๋‹ค.

 

 

 

 

 

    ๐Ÿ”ฝ  ๊ตฌ์„ฑํ•˜๊ธฐ

        ๐Ÿ“ฆ ๊ตฌ์„ฑ

๋ณธ๊ฒฉ์ ์œผ๋กœ Logrotate๋ฅผ ๊ฐ€์ง€๊ณ  ๋†€์•„ ๋ณด๋ ค๊ณ  ํ•ด์š”.

์ตœ์ดˆ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•ด์„œ Logrotate์— ๊ธฐ๋ณธ ์„ค์ •์ด ์–ด๋–ป๊ฒŒ ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ด ๋ณผ๊ฒŒ์š”.

cat /etc/logrotate.conf

 

Logrotate Deamon Path

 

cat /etc/logrotate.conf

๐Ÿ’ก ์ฐธ๊ณ  ์‚ฌํ•ญ
Logrotate.conf ๋ถ„์„

1. ๋กœ๊ทธ ํšŒ์ „ ์ฃผ๊ธฐ
# rotate log files weekly
weekly

์›ํ•˜๋Š” ์ฃผ๊ธฐ์— ๋งž์ถ”์–ด ๋กœ๊ทธ ํšŒ์›์„ ์„ค์ •.
โˆ™ yearly : ๋งค๋…„
โˆ™ monthly : ๋งค๋‹ฌ
โˆ™ weekly : ๋งค์ฃผ
โˆ™ daily : ๋งค์ผ

2. ๋กœ๊ทธ ํŒŒ์ผ ๊ฐœ์ˆ˜
# keep 4 weeks worth of backlogs
rotate 5

์ •๋ฆฌํ•  Log File ๊ฐœ์ˆ˜ ์ง€์ •. ํ•ด๋‹น ๊ฐœ์ˆ˜๊ฐ€ ๋„˜์–ด๊ฐ€๊ฒŒ ๋˜๋ฉด ๋กœ๊ทธ ํšŒ์ „ ์ฃผ๊ธฐ์— ๋”ฐ๋ผ ์ง„ํ–‰.


3. ์ƒˆ๋กœ์šด Log File ์ƒ์„ฑ ์—ฌ๋ถ€
# create new (empty) log files after rotating old ones
create

Log File ์ •๋ฆฌ ๋’ค ์ถ”๊ฐ€ Log File ์ƒ์„ฑ ์—ฌ๋ถ€ ์ง€์ •
โˆ™ create : Log file ์ƒ์„ฑ
โˆ™ empty : Log File ์ƒ์„ฑ ์•ˆํ•จ


4. Log File Name ๋‚ ์งœ ๋ถ€์—ฌ
# use date as a suffix of the rotated file
dateext

Logrotate ์‹คํ–‰ ๋’ค Log File์— ๋‚ ์งœ ์ถ”๊ฐ€
โˆ™ dateext : Log File Name์— ๋‚ ์งœ ์ถ”๊ฐ€
โˆ™ #dateext : Log File Name์— ๋‚ ์งœ ์ถ”๊ฐ€ ์•ˆํ•จ.



5. Log File ์••์ถ• ์—ฌ๋ถ€
# uncomment this if you want your log files compressed
compress
Log File ์••์ถ• ์—ฌ๋ถ€ ์„ ํƒ (์••์ถ•์„ ํ†ตํ•œ Log File ์šฉ๋Ÿ‰ ๊ฐ์†Œ ํšจ๊ณผ)
โˆ™ compress : Log File ์••์ถ•
โˆ™ #compress : Log File ์••์ถ• ์•ˆํ•จ.


6. ๊ฐœ๋ณ„ Log ์ •๋ฆฌ Process Path ์ง€์ •
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

 

ํŠน์ • Directory๋ฅผ ์ง€์ •ํ•˜์—ฌ Logrotate ๊ด€๋ฆฌ.
include [๊ฒฝ๋กœ] : Logrotate Process(Daemon) ๊ฒฝ๋กœ ์ง€์ •.




vim /etc/logrotate.d/github-clone-log-management


์ฃผ๋‹ˆํ•˜๋ž‘์€ ์œ„์™€ ๊ฐ™์ด GitHub Code๋ฅผ Cloneํ•˜๋Š” Cron์— Log๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์„ค์ • ๋‚ด์šฉ์„ ์ž‘์„ฑํ•ด ์ฃผ์—ˆ์–ด์š”.

 

๐Ÿ’ก ์ฐธ๊ณ  ์‚ฌํ•ญ
Logrotate.d/[File Name] ๋ถ„์„

1. Log Path

์ตœ์ดˆ Log File์ด ์žˆ๋Š” ๊ฒฝ๋กœ๋ฅผ ์ž‘์„ฑํ•˜๊ณ , ์ค‘๊ด„ํ˜ธ๋กœ ๋ฌถ์–ด์ค€๋‹ค.


2. ๊ธฐ๊ฐ„ ๋‹จ์œ„ ์„ค์ •

โˆ™ yearly : ๋งค๋…„
โˆ™ monthly : ๋งค๋‹ฌ
โˆ™ weekly : ๋งค์ฃผ
โˆ™ daily : ๋งค์ผ



3. ์ตœ๋Œ€ Log File ๊ฐœ์ˆ˜

Log File ์ •๋ฆฌ ์ฃผ๊ธฐ ์„ค์ •
โˆ™ rotate 4 : Log File์ด 4๊ฐœ๊ฐ€ ๋˜๋ฉด ์‚ญ์ œ
โˆ™ empty : Log File ์ƒ์„ฑ ์•ˆํ•จ

4. Log File ์กด์žฌ ์—ฌ๋ถ€ ๊ด€๋ จ ํ™•์ธ ๋ฐ ์กฐ์น˜
โˆ™ missingok : Log File์ด ์กด์žฌํ•˜์ง€ ์•Š์•„๋„ Error๋ฅผ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”๋‹ค.


5. Log ๋‚ด๋ถ€ ๊ด€๋ จ ์„ค์ •

Log File ๋‚ด์— ๋‚ด์šฉ์ด ๋น„์–ด์žˆ๋‹ค๋ฉด Rotate ์ž‘๋™์„ ์–ด๋–ป๊ฒŒ ํ•  ๊ฒƒ์ธ์ง€๋ฅผ ์„ค์ •
โˆ™ notifempty : Log๊ฐ€ ๋น„์–ด ์žˆ๋‹ค๋ฉด Rotate ์ง„ํ–‰ ์•ˆํ•จ.



6. Log File ์••์ถ• ์—ฌ๋ถ€
Log File ์••์ถ• ์—ฌ๋ถ€ ์„ ํƒ (์••์ถ•์„ ํ†ตํ•œ Log File ์šฉ๋Ÿ‰ ๊ฐ์†Œ ํšจ๊ณผ)
โˆ™ compress : Log File ์••์ถ•
โˆ™ #compress : Log File ์••์ถ• ์•ˆํ•จ.


7. Log File ๊ณต์œ  ์—ฌ๋ถ€
Log File์ด ์—ฌ๋Ÿฌ๊ฐœ ์žˆ์–ด๋„ Script๋ฅผ ๊ณต์œ  ์—ฌ๋ถ€ ์„ค์ •
โˆ™ sharedscripts : Script ๊ณต์œ 


8. ์‚ฌํ›„ ์ถ”๊ฐ€ Script ์‹คํ–‰
Logrotate๊ฐ€ ์‹คํ–‰๋œ ๋’ค ์ถ”๊ฐ€๋กœ ์‹คํ–‰ํ•˜๊ณ  ์‹ถ์€ Script๊ฐ€ ์žˆ๋‹ค๋ฉด ์‹คํ–‰ ๋ช…๋ น
(postrotate์™€ endscript ์•ˆ์— Script ๊ฒฝ๋กœ ๋ฐ ๋ช…๋ น์–ด ์„ค์ •)
postrotate
/server/apache2/bin/apachectl graceful
endscript


9. ์ถ”๊ฐ€ ์‚ฌํ•ญ

rotate 30(์ˆซ์ž)  : logํŒŒ์ผ 30๊ฐœ ์ด์ƒ ๋˜๋ฉด ์‚ญ์ œ
maxage 30(์ˆซ์ž) : 30์ผ ์ด์ƒ ์ง€๋‚œ ๋กœ๊ทธ ํŒŒ์ผ ์‚ญ์ œ
size : ์ง€์ •ํ•œ ์šฉ๋Ÿ‰์ด ๋˜๋ฉด ๋กœ๊ทธ๋กœํ…Œ์ดํŠธ๋ฅผ ์‹คํ–‰ํ•œ๋‹ค. 10k, 10M ์ด๋Ÿฐ์‹์œผ๋กœ ์ง€์ •ํ•œ๋‹ค.
create : [๊ถŒํ•œ ์œ ์ € ๊ทธ๋ฃน] ์œผ๋กœ rotation๋œ ๋กœ๊ทธํŒŒ์ผ ์ƒ์„ฑ
notifempty : log ๋‚ด์šฉ์ด ์—†์œผ๋ฉด rotation ํ•˜์ง€ ์•Š๋Š”๋‹ค.
ifempty : ๋กœ๊ทธํŒŒ์ผ์ด ๋น„์–ด์žˆ๋Š” ๊ฒฝ์šฐ์—๋„ ๋กœํ…Œ์ดํŠธํ•œ๋‹ค.
monthly : ์›” ๋‹จ์œ„๋กœ ๋กœํ…Œ์ดํŠธ ํ•œ๋‹ค.
daily : ์›” ๋‹จ์œ„๋กœ ๋กœํ…Œ์ดํŠธ ํ•œ๋‹ค.
weekly : ์›” ๋‹จ์œ„๋กœ ๋กœํ…Œ์ดํŠธ ํ•œ๋‹ค.
compress : rotate ๋œ ๋กœ๊ทธ gzip ์••์ถ•
nocompress : ์••์ถ•์„ ์›์น˜ ์•Š๋Š”๋‹ค.
mail admin@mail : ๋กœํ…Œ์ดํŠธ ์„ค์ •์— ์˜ํ•ด ๋ณด๊ด€์ฃผ๊ธฐ๊ฐ€ ๋๋‚œ ํŒŒ์ผ์„ ๋ฉ”์ผ๋กœ ๋ฐœ์†กํ•œ๋‹ค.
mailfirst admin@mail : ๋กœํ…Œ์ดํŠธ์‹œ ์‹ ๊ทœํŒŒ์ผ ์ด์ „์˜ ๋กœ๊ทธ๋ฅผ ๋ฉ”์ผ๋กœ ๋ฐœ์†กํ•œ๋‹ค.
nomail : ๋ฉ”์ผ๋กœ ํ†ต๋ณด๋ฐ›์ง€ ์•Š์Œ.
errors admin@mail : ๋กœํ…Œ์ดํŠธ ์‹คํ–‰์‹œ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ์ด๋ฉ”์ผ๋กœ ํ†ต๋ณดํ•œ๋‹ค.
prerotate-endscript : ์‚ฌ์ด์˜ ๋ช…๋ น์–ด๋ฅผ ๋กœ๊ทธํŒŒ์ผ ์ฒ˜๋ฆฌ์ „์— ์‹คํ–‰ํ•œ๋‹ค.
postrotate-endscript : ์‚ฌ์ด์˜ ๋ช…๋ น์–ด๋ฅผ ๋กœ๊ทธํŒŒ์ผ ์ฒ˜๋ฆฌํ›„์— ์‹คํ–‰ํ•œ๋‹ค.
extension : ๋กœํ…Œ์ดํŠธ ํ›„ ์ƒ์„ฑ๋˜๋Š” ํŒŒ์ผ์˜ ํ™•์ •์ž๋ฅผ ์ง€์ •ํ•œ๋‹ค.
copytruncate : ์ด์˜ต์…˜์„ ๋„ฃ์ง€ ์•Š์œผ๋ฉด ํ˜„์žฌ ์‚ฌ์šฉ์ค‘์ธ ๋กœ๊ทธ๋ฅผ ๋‹ค๋ฅธ์ด๋ฆ„์œผ๋กœ moveํ•˜๊ณ  ์ƒˆ๋กœ์šด ํŒŒ์ผ์„ ์ƒ์„ฑํ•œ๋‹ค.


 






    ๐Ÿ”ฝ  ์‹คํ–‰ํ•˜๊ธฐ

        ๐Ÿ“ฆ ์‹คํ–‰

/usr/sbin/logrotate -v /etc/logrotate.d/{logrotate Script Name}


์ตœ์ดˆ ์ฃผ๋‹ˆํ•˜๋ž‘์€ ํŠน์ • Log rotate Process๋ฅผ ์‹คํ–‰ํ• ๊ฑด๋ฐ, ๊ทธ๊ฑธ ํ™”๋ฉด์— ์ถœ๋ ฅํ•˜๊ณ  ์‹ถ์–ด์„œ ์œ„์™€ ๊ฐ™์ด ๋ช…๋ น์–ด๋ฅผ ์ฃผ์—ˆ์–ด์š”.


/usr/sbin/logrotate /etc/logrotate.d{Script Name}


๊ทธ๋Ÿฐ ๋’ค ์ž‘๋™์„ ํ•˜๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด ์œ„์™€ ๊ฐ™์ด ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ด ์ฃผ์—ˆ์–ด์š”.



cat /var/lib/logrotate/status

๋ฐ˜์‘ํ˜•


Logrotate๊ฐ€ ์ •์ƒ ์ž‘๋™๋˜๊ณ  ์žˆ๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.



๐Ÿ’ก ์ฐธ๊ณ  ์‚ฌํ•ญ
Logrotate ์‹คํ–‰ ๊ด€๋ จ ๋ช…๋ น์–ด

1. logrotate ์ „์ฒด ์‹คํ–‰
/usr/sbin/logrotate -d /etc/logrotate.conf


2. ํŠน์ • Logrotate Process ์‹คํ–‰
/usr/sbin/logrotate -d /etc/logrotate.d/{Script File Name}


3. Logrotate Debug Mode
/usr/sbin/logrotate -d /etc/logrotate.conf


4. ์‹คํ–‰ ๊ณผ์ • ํ™”๋ฉด ์ถœ๋ ฅ
/usr/sbin/logrotate -v /etc/logrotate.conf


5. Logroteate ์ฆ‰๊ฐ ์‹คํ–‰
/usr/sbin/logrotate -f /etc/logrotate.d/{Script File Name}


๊ธฐ๋ณธ์ ์œผ๋กœ Logrotate๋Š” Linux์˜ cron.d๋กœ ์‹คํ–‰๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋”ฐ๋กœ ์žฌ์‹œ์ž‘์„ ํ•ด ์ค„ ํ•„์š”๋Š” ์—†๋Š” ๊ฒƒ์ด์—์š”.
ํ•˜์ง€๋งŒ, ๋‹น์žฅ ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์œ„์™€ ๊ฐ™์ด ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋‹ต๋‹ˆ๋‹ค.





 

[ํ•œ๋น›๋ฏธ๋””์–ด]์ด๊ฒƒ์ด ์šฐ๋ถ„ํˆฌ ๋ฆฌ๋ˆ…์Šค๋‹ค : ์šฐ๋ถ„ํˆฌ ๋ฆฌ๋ˆ…์Šค ์„ค์น˜๋ถ€ํ„ฐ ๋„คํŠธ์›Œํฌ์™€ ์„œ๋ฒ„ ๊ตฌ์ถ• ์šด์˜๊นŒ์ง€

COUPANG

www.coupang.com

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 

 

 

 

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•

'System ์ž‘์—…์‹ค > LINUX' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Linux] SSL/TLS ์ธ์ฆ์„œ ๋งŒ๋“ค๊ธฐ  (0) 2022.11.16
[CentOS 7.9] Synology NAS Volume Mount  (4) 2022.11.09
[CentOS] 7.9 Minikube ์„ค์น˜  (0) 2022.09.13
[CentOS] 7.9 Docker ์„ค์น˜  (0) 2022.09.13
[Ubuntu] 22.04 LTS Ansible ์„ค์น˜  (0) 2022.09.06