Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
how logrotate works
Search
tokuhirom
April 11, 2020
Technology
460
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
how logrotate works
tokuhirom
April 11, 2020
Other Decks in Technology
See All in Technology
形式手法を使って仕様をコーディングしよう
mikanichinose
0
190
検証フェーズはAIの回答を判断するための学習機会
toru_kubota
2
520
BedrockとLambdaで作る リアルタイム進行型推理ゲーム
kawametho
0
200
FactoryBotアンチパターン / factory_bot anti-patterns
toshimaru
0
140
生成AIで高い生産性を求められて、 悩み、乗り越えた話
mot_techtalk
2
130
ミイダス株式会社 テックチームのご紹介 / MIIDAS Tech Team
miidas
0
170
自分で立ててみるLLMサービス
y_sera15
0
140
SDDの運用にめげずに向き合った話
sansantech
PRO
1
140
AI駆動開発、viviONの1年 ── うまくいったこと・いかなかったこと
vivion
0
270
Snowflake Horizon Catalog と Apache Iceberg で作る オープンなデータ基盤
kitagawaz
0
460
使いこなすために知っておきたい Azure SRE Agent アンチパターン
torumakabe
2
410
全PRの83%が AIレビューだけでマージできるようになった開発組織は その後どうなったか @2026/10
athug
0
120
Featured
See All Featured
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Optimizing for Happiness
mojombo
378
71k
Ruling the World: When Life Gets Gamed
codingconduct
0
390
A Tale of Four Properties
chriscoyier
163
24k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Docker and Python
trallard
47
4.2k
Being A Developer After 40
akosma
91
590k
Embracing the Ebb and Flow
colly
88
5.2k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Paper Plane (Part 1)
katiecoart
PRO
2
11k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
Transcript
logrotate の仕組み
Logrotate とは? • https://linux.die.net/man/8/logrotate • https://github.com/logrotate/logrotate • ログファイルをローテーションするプログラム • デーモンではなく
cron で実行されている。
本スライドでは以下のような設定を想定 /var/log/nginx/*log { daily # 一日一回 rotate(hourly, monthly, yearly なども指定可能)
missingok # 元ファイルがなくてもエラーにしない rotate 1 # 1世代を保持 compress # 古いファイルを圧縮する delaycompress # mv した回の次の rotate のタイミングで圧縮する notifempty # ファイルが空だったら rotate しない create 640 www www # www ユーザーで、file mode 640 で新規ファイルを作成 sharedscripts # パターンにマッチするファイルが複数個あっても一回しか # postrotate が実行されないようにする postrotate # rotate 後に、以下のスクリプトを実行する [ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid` endscript } /etc/logrotate.d/nginx 等に配置。
access.log-20200408 access.log-20200407.gz Nginx が access.log にログを書いている。 access.log nginx
access.log-20200409 logrotate access.log access.log-20200408 access.log-20200407.gz logrotate がファイルをmv する。 nginx はファイルを開いたままなので古いファイルに書き続ける
nginx mv access.log access.log-20200409
access.log-20200409 logrotate access.log access.log-20200408 access.log-20200407.gz `create 640 www www` が指定されているので新規に
access.log を作成する。 nginx touch access.log
nginx access.log-20200409 logrotate kill –USR1 $(cat /var/run/nginx.pid) access.log access.log-20200408 access.log-20200407.gz
logrotate が nginx にシグナル SIGUSR1 を送信する。 nginx は “access.log” を開き直す。以後は新しいファイルにログが書き込まれ る。
nginx access.log-20200409 logrotate gzip -9 access.log-20200408 access.log access.log-20200408.gz access.log-20200407.gz logrotate
は古いファイルを圧縮する。
nginx access.log-20200409 logrotate rm access.log-20200407.gz access.log access.log-20200408.gz logrotate はめっちゃ古いファイルを自動削除する。 access.log-20200407.gz