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

推荐订阅源

大猫的无限游戏
大猫的无限游戏
博客园 - 【当耐特】
Cloudbric
Cloudbric
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Attack and Defense Labs
Attack and Defense Labs
爱范儿
爱范儿
The Cloudflare Blog
腾讯CDC
Security Archives - TechRepublic
Security Archives - TechRepublic
TaoSecurity Blog
TaoSecurity Blog
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements
C
Check Point Blog
Schneier on Security
Schneier on Security
S
Schneier on Security
J
Java Code Geeks
B
Blog RSS Feed
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
Stack Overflow Blog
Stack Overflow Blog
博客园_首页
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
A
About on SuperTechFans
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
A
Arctic Wolf
S
Secure Thoughts
P
Palo Alto Networks Blog
The Last Watchdog
The Last Watchdog
SecWiki News
SecWiki News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 三生石上(FineUI控件)
D
Darknet – Hacking Tools, Hacker News & Cyber Security
量子位
U
Unit 42
I
InfoQ
D
DataBreaches.Net
P
Privacy International News Feed
T
Troy Hunt's Blog
博客园 - 叶小钗
T
Threatpost
博客园 - Franky
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
www.infosecurity-magazine.com
www.infosecurity-magazine.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cisco Blogs

日常 on 打工人日志

Proxmox VE(PVE) 更新到最新版本 iStoreOS(旁路由)使用openclash实现dns劫持 异常流量分析:图片库服务黑客入侵 openwrt 硬盘扩容 搭建ip地址检索服务 通知:《打工人日报》迁移到独立板块 黑群晖最新安装教程 推荐一下 容器云资源 2010年的天涯神贴聊房价 如何礼貌回绝不合理的需求 github 国内代理访问下载 逆境和成长-2022年终总结 优雅的使用Conda管理python环境 shell功能脚本集合 Cloudflare Zero Trust 内网穿透 headscale 部署使用 羊了个羊小程序 破解通关 RocketMQ k8s部署 4主4从集群 linux服务器 删除空间却未释放 VSCode插件推荐=> Code Runner ant build.xml 编写 记录一次上门打散工 Ant中如何添加第三方jar包依赖 linux 网络测速 网心云挂机教程 | 轻松实现睡后收入~ Proxmox VE 在线扩容磁盘分区 centos7.9 网络配置 RocketMQ 安装和启动 安装 minIO Azure S3网关 安装配置 Terraform rsync 文件同步 获取用户浏览器默认语言设置,自动判断跳转不同网站 linux系统开启root权限 163企业邮箱设置教程 2021年第50周记 自建服务器内网穿透 树莓派搭建k3s 优秀英语教材的选择
logrotate 日志滚动的使用
2021-12-29 · via 日常 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)时轮换