惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy International News Feed
I
Intezer
T
Tenable Blog
S
Schneier on Security
Project Zero
Project Zero
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
Know Your Adversary
Know Your Adversary
博客园 - 司徒正美
The Cloudflare Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News and Events Feed by Topic
博客园 - 叶小钗
宝玉的分享
宝玉的分享
L
LINUX DO - 热门话题
aimingoo的专栏
aimingoo的专栏
S
Secure Thoughts
Forbes - Security
Forbes - Security
T
The Exploit Database - CXSecurity.com
D
Darknet – Hacking Tools, Hacker News & Cyber Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 【当耐特】
罗磊的独立博客
IT之家
IT之家
H
Hacker News: Front Page
I
InfoQ
云风的 BLOG
云风的 BLOG
S
Security Affairs
M
MIT News - Artificial intelligence
GbyAI
GbyAI
Jina AI
Jina AI
Help Net Security
Help Net Security
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
Webroot Blog
Webroot Blog
L
Lohrmann on Cybersecurity
A
About on SuperTechFans
Attack and Defense Labs
Attack and Defense Labs
The Register - Security
The Register - Security
V
V2EX
G
Google Developers Blog
D
DataBreaches.Net
Apple Machine Learning Research
Apple Machine Learning Research
C
Cybersecurity and Infrastructure Security Agency CISA
J
Java Code Geeks
W
WeLiveSecurity
Cloudbric
Cloudbric
T
Tor Project blog

daliy on 打工人日志

iStoreOS(旁路由)使用openclash实现dns劫持 异常流量分析:图片库服务黑客入侵 openwrt 硬盘扩容 搭建ip地址检索服务 【福利】免费!本地部署!去除视频中移动的物体 通知:《打工人日报》迁移到独立板块 KyBook 3 | calibre-web - IOS系统最佳图书伴侣 iOS 17 「待机显示」适配普通 iPhone(非 Pro/Max),屏幕在充电时常亮 【福利】埃隆·马斯克传 [沃尔特·艾萨克森] 在线下载 【破解】小鹏P5和小鹏G9开启adb和网络adb 3D Gaussian Splatting:3D模型渲染 2023亚运会电竞门票民购买指南(报名+抽签) 大麦抢票辅助软件(福利 TFBOYS十年之约演唱会 2023 全机位 视频) 最好的微信朋友圈集赞神器-福利推荐 2010年的天涯神贴聊房价 github 国内代理访问下载 逆境和成长-2022年终总结 优雅的使用Conda管理python环境 shell功能脚本集合 headscale 部署使用 羊了个羊小程序 破解通关 rsync 文件同步 163企业邮箱设置教程 2021年第50周记 优秀英语教材的选择
logrotate 日志滚动的使用
2021-12-29 · via daliy on 打工人日志

logrotate 日志滚动的使用

logrotate 日志滚动切割工具,是 linux 默认安装的工具,配置文件位置:

1/etc/logrotate.conf
2/etc/logrotate.d/

参数

以 nginx 配置为例

 1/opt/log/nginx/*.log {
 2	daily
 3	missingok
 4	rotate 14
 5    errors "nb@nbtyfood.com"
 6	compress
 7	delaycompress
 8	notifempty
 9	create 0640 www-data adm
10	sharedscripts
11	prerotate
12		if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
13			run-parts /etc/logrotate.d/httpd-prerotate; \
14		fi \
15	endscript
16	postrotate
17		invoke-rc.d nginx rotate >/dev/null 2>&1
18	endscript
19}
参数作用
compress压缩日志文件的所有非当前版本
daily,weekly,monthly按指定计划轮换日志文件
delaycompress压缩所有版本,除了当前和下一个最近的
endscript标记 prerotate 或 postrotate 脚本的结束
errors “emailid”给指定邮箱发送错误通知
missingok如果日志文件丢失,不要显示错误
notifempty如果日志文件为空,则不轮换日志文件
olddir “dir”指定日志文件的旧版本放在 “dir” 中
postrotate引入一个在日志被轮换后执行的脚本
prerotate引入一个在日志被轮换前执行的脚本
rotate ’n'在轮换方案中包含日志的 n 个版本
sharedscripts对于整个日志组只运行一次脚本
size=‘logsize’在日志大小大于 logsize(例如 100K,4M)时轮换