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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
PCI Perspectives
PCI Perspectives
Webroot Blog
Webroot Blog
罗磊的独立博客
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Last Week in AI
Last Week in AI
美团技术团队
Help Net Security
Help Net Security
The Hacker News
The Hacker News
C
Cisco Blogs
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
The Register - Security
The Register - Security
IT之家
IT之家
WordPress大学
WordPress大学
Jina AI
Jina AI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Help Net Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
NISL@THU
NISL@THU
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
B
Blog
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
S
Security Affairs
小众软件
小众软件
Hacker News: Ask HN
Hacker News: Ask HN
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
A
Arctic Wolf
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence

博客园 - royalrover

How LLMs Actually Work(翻译) 微调LLM前你需要了解的一些概念-- 反向传播解析 微调LLM前你需要了解的一些概念-- 基于 Qwen3 配置文件的实践 微调LLM前你需要了解的一些概念2--多头注意力机制 微调LLM前你需要了解的一些概念1 -- 综述 从控制论看 Harness Engineering:当反馈回路终于能在"重要的地方"闭合 快速搭建你的数据智能分析 Agent 5分钟Mac本地跑通32B Qwen!免费GPT-4o替代,还能5分钟造个会开浏览器+执行Shell的AI Agent 深入剖析 nanobot:轻量级 AI Agent 框架的架构之道 k8s上手 iOS MDM(监管锁)入门 SRE中的SLA/SLO/SLI 开放网关统一认证服务 业务网关之AK中心建设 Feature Police导致iframe页面无法使用粘贴功能 页面异步请求canceled 或 network中接口请求成功但无法查看返回值 我在阿里云做云开发平台 阿里云云开发平台助力企业Serverless架构升级实战 随心一笔 nodejs中的并发编程 基于Unix Socket的可靠Node.js HTTP代理实现(支持WebSocket协议) cluster模块设置子进程的stdio - royalrover - 博客园 serverless在微店node领域的探索应用 node应用远程调试教程 Node EE方案 -- Rockerjs在微店的建设与发展
nginx(tengine)访问日志分片
royalrover · 2019-10-12 · via 博客园 - royalrover

说明

nginx日志按天分片是运维的基本要求,不仅可以减小文件大小,方便检索关键数据,也可以定时删除过期的日志。可是nginx和tengine默认并不支持文件分片,因此需要额外处理。

另外,日志分片需要借助 ngx_http_log_module 模块,默认通过yum安装的nginx并不携带此模块,需要额外编译。而tengine默认自带了ngx_http_log_module模块,因此建议使用者直接源码编译tengine即可。

原理

日志分片的原理是利用命名管道。linux下一切皆文件,因此创建命名管道作为linux的访问日志,由第三方程序连接命名管道,获取数据后按时间进行分片。这里的第三方程序既可以是由使用者自己编写的处理程序,也可使用开源的软件,如 cronolog。下文采用cronolog实现日志分片。

步骤

  1. 创建命名管道:mkfifo /opt/logs/nginx/access.log
  2. 启动cronolog:
cronolog /opt/logs/nginx/access.log.%Y-%m-%d <  /opt/logs/nginx/access.log &
cronolog /opt/logs/nginx/error.log.%Y-%m-%d < /opt/logs/nginx/error.log &
  1. 修改nginx配置文件:
    http内
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    
    access_log   /opt/logs/nginx/access.log main;
    
  2. 重启nginx:nginx -s reload