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

推荐订阅源

L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog
月光博客
月光博客
S
SegmentFault 最新的问题
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
人人都是产品经理
人人都是产品经理
K
Kaspersky official blog
Forbes - Security
Forbes - Security
宝玉的分享
宝玉的分享
爱范儿
爱范儿
V
Visual Studio Blog
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
The Cloudflare Blog
Attack and Defense Labs
Attack and Defense Labs
美团技术团队
L
LangChain Blog
NISL@THU
NISL@THU
IT之家
IT之家
T
Tor Project blog
云风的 BLOG
云风的 BLOG
Security Latest
Security Latest
Apple Machine Learning Research
Apple Machine Learning Research
Cisco Talos Blog
Cisco Talos Blog
I
InfoQ
Help Net Security
Help Net Security
Engineering at Meta
Engineering at Meta
Know Your Adversary
Know Your Adversary
I
Intezer
Recent Commits to openclaw:main
Recent Commits to openclaw:main
TaoSecurity Blog
TaoSecurity Blog
P
Palo Alto Networks Blog
GbyAI
GbyAI
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - Franky
L
Lohrmann on Cybersecurity
The Register - Security
The Register - Security
W
WeLiveSecurity
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
AWS News Blog
AWS News Blog
G
GRAHAM CLULEY

博客园 - 软件心理学工程师

SPIFFE/SPIRE 的身份哲学与技术实现 后量子密码学(post-quantum cryptography):为什么重要以及如何使用 密钥管理碎碎念 SpringBoot集成resilience4j进行熔断和一个响应式编程的问题 凤凰项目&DevOps实践指南 OAuth2和OpenID API横向越权问题的分析和解决 初识RAG 基于AWS的密钥管理系统 加密算法的使用场景 Linux透明大页(Transparent Huge Pages)对ES性能对影响 《java8 in action》读书笔记 ES索引的一些长度限制 初识redis Elasticsearch慢查询故障诊断 Elasticsearch搜索调优 elasticsearch基础知识杂记 elasticsearch.yml 常用参数说明 elasticsearch local debug环境搭建 CAP碎碎念 彻底删除kafka topic步骤
linux log rotate
软件心理学工程师 · 2017-12-31 · via 博客园 - 软件心理学工程师

今天老大提醒我产线kafka自身的log文件积累了好几个月了,我才发现原来kafka的log4j并删除old log。

第一反应是采用linux自带的logrotate功能,在/etc/logrotate.d下面建一个文件写入:

/opt/kafka_2.11-0.9.0.0/logs/*.log* {
daily
rotate 3
missingok
notifempty
}

第二招是利用kafka自身的log4j.properties里面加上只保存最近几天的log。

第三招最简单有效,自己写一个sh命令,删除指定文件夹下的指定天数之前的文件:

find ${kafka_directory}/logs/ -mtime +30 -name "*.log.*" -exec rm -rf {}