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

推荐订阅源

S
Schneier on Security
The Register - Security
The Register - Security
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
博客园 - 司徒正美
罗磊的独立博客
U
Unit 42
S
SegmentFault 最新的问题
Y
Y Combinator Blog
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
J
Java Code Geeks
Schneier on Security
Schneier on Security
Know Your Adversary
Know Your Adversary
C
Check Point Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Simon Willison's Weblog
Simon Willison's Weblog
V
Vulnerabilities – Threatpost
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
The Hacker News
The Hacker News
博客园 - 叶小钗
C
Cybersecurity and Infrastructure Security Agency CISA
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Latest news
Latest news
L
Lohrmann on Cybersecurity
A
About on SuperTechFans
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
S
Securelist
A
Arctic Wolf
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Threatpost
Scott Helme
Scott Helme
博客园 - 聂微东
博客园 - 【当耐特】
T
Tenable Blog
I
Intezer
D
DataBreaches.Net
B
Blog RSS Feed
Security Latest
Security Latest
C
Cisco Blogs
T
Tor Project blog
N
Netflix TechBlog - Medium

日常系列 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)时轮换