CCLogger 是什么?
CCLogger 记录 Paper 服务器上的玩家活动。聊天消息、指令、加入、离开、踢出——所有内容都会记录到您选择的存储后端中。
您可以使用纯文本文件以简化操作,如果希望在不依赖外部组件的情况下进行查询,可以使用 SQLite;对于大型部署,可以连接 MySQL、MongoDB 或 Redis。所有写入操作均为异步执行,因此不会影响服务器的 TPS(每秒刻数)。
功能特性
日志记录
聊天 - 带有时间戳、世界名称和坐标的消息
指令 - 所有指令(支持黑名单,例如 /login、/register 等)
连接 - 加入、离开、踢出事件
输出选项:
- 全局日志文件 (chat.log, commands.log)
- 按玩家生成的文件 (players/Steve.log)
- 自定义格式占位符:
%date、%name、%content、%world、%x、%y、%z
存储
文件 - 纯文本文件,人类可读(无需配置)
SQLite - 本地数据库,无需配置(无需配置)
MySQL - 适用于多服网络的共享数据库(需要 MySQL 服务器)
MongoDB - 文档型存储,支持水平扩展(需要 MongoDB)
Redis - 高速内存存储,适合高并发场景(需要 Redis)
所有后端均使用异步写入和连接池技术。
隐私保护
支持多种 IP 记录模式以满足 GDPR 合规要求:
- disabled - 不存储 IP 地址
- truncated - 将最后一段置零(192.168.1.x 变为 192.168.1.0)
- hashed - 使用每日轮换盐值的 bcrypt 哈希
- full - 完整存储 IP 地址
可以通过正则表达式屏蔽特定指令。拥有 cclogger.exempt 权限的玩家不会被记录日志。
警报通知
实时监控关键词和指令:
- 定义触发词(例如 "hack"、"cheat"、"exploit")
- 定义触发指令(例如 "/op"、"/gamemode")
- 拥有
cclogger.notify 权限的管理员会收到游戏内警报
- 所有触发记录均会写入文件
Web 仪表盘
CCLogger 包含一个基于 React 的现代 Web 仪表盘(默认禁用):
仪表盘概览
- 统计概览及日志类型细分
- 日志分布饼图
- 显示近期活动的活动时间线
- 一目了然的活跃玩家排行
实时时间线
- 自动刷新的实时活动流
- 支持通过键盘快捷键暂停/恢复
- 可按日志类型筛选(聊天、指令、登录、登出)
- 滚动后出现“跳至最新”按钮
日志浏览器
- 全库全文搜索
- 按类型、玩家、日期范围筛选
- 大数据量结果集的分页功能
- 导出为 JSON 或 CSV 格式
玩家档案
- 显示 Minecraft 头像(通过 Crafatar)
- 每位玩家的活动统计数据
- 近期活动历史记录
- 点击任意玩家姓名即可查看其档案
REST API
POST /api/auth/token - 获取 JWT Token
GET /api/logs - 带筛选条件的日志查询
GET /api/logs/player/{name} - 指定玩家的日志
GET /api/logs/search?q=term - 搜索日志内容
GET /api/stats - 统计数据
支持 JWT 认证与速率限制。
运行环境要求
- Paper 1.21+ 或 Folia
- Java 21+
指令
/cclogger - 显示帮助信息
/cclogger reload - 重载配置(需要 cclogger.reload 权限)
/cclogger count <word> [player] - 统计词频(需要 cclogger.statistics 权限)
/cclogger clear - 归档并清空日志(需要 cclogger.admin 权限)
权限节点
cclogger.* - 所有权限(默认:OP)
cclogger.notify - 接收警报通知(默认:OP)
cclogger.exempt - 豁免日志记录(默认:false)
cclogger.reload - 重载配置(默认:OP)
cclogger.statistics - 使用计数指令(默认:OP)
cclogger.admin - 清空/归档日志(默认:OP)
cclogger.web - Web API 访问权限(默认:OP)
安装设置
- 将 JAR 文件放入
plugins/ 目录
- 重启服务器
- 编辑
plugins/CCLogger/config.yml
- 执行
/cclogger reload
默认配置开箱即用。如果您不想使用 SQLite,请修改 storage.type 设置。
配置示例
storage:
type: sqlite # file, sqlite, mysql, mongodb, redis
privacy:
ip-logging: disabled
notifications:
enabled: true
chat-keywords:
- "hack"
- "cheat"
web:
enabled: false
port: 8080
相关链接
What is CCLogger?
CCLogger logs player activity on Paper servers. Chat messages, commands, joins, quits, kicks - it all gets recorded to your storage backend of choice.
You can use flat files for simplicity, SQLite if you want queries without external dependencies, or connect to MySQL, MongoDB, or Redis for larger setups. All writes happen async so your server tick rate stays clean.
Features
Logging
Chat - Messages with timestamp, world, and coordinates
Commands - All commands (blacklist supported for /login, /register, etc.)
Connections - Join, quit, kick events
Output options:
- Global log files (chat.log, commands.log)
- Per-player files (players/Steve.log)
- Custom format with placeholders:
%date, %name, %content, %world, %x, %y, %z
Storage
File - Text files, human-readable (no setup)
SQLite - Local database, no config needed (no setup)
MySQL - Shared database for networks (requires MySQL server)
MongoDB - Document store, scales horizontally (requires MongoDB)
Redis - Fast, in-memory, good for high volume (requires Redis)
All backends use async writes and connection pooling.
Privacy
IP logging modes for GDPR compliance:
- disabled - IPs not stored
- truncated - Last octet zeroed (192.168.1.x becomes 192.168.1.0)
- hashed - bcrypt hash with daily rotating salt
- full - Complete IP stored
Commands can be blacklisted with regex patterns. Players with cclogger.exempt permission are excluded from logging.
Alerts
Monitor keywords and commands in real-time:
- Define trigger words (e.g., "hack", "cheat", "exploit")
- Define trigger commands (e.g., "/op", "/gamemode")
- Ops with
cclogger.notify get in-game alerts
- All triggers logged to file
Web Dashboard
CCLogger includes a modern React-based web dashboard (disabled by default):
Dashboard
- Stats overview with log type breakdown
- Log distribution pie chart
- Activity timeline showing recent activity
- Top active players at a glance
Live Timeline
- Real-time activity feed that auto-refreshes
- Pause/resume with keyboard shortcuts
- Filter by log type (Chat, Command, Login, Logout)
- Jump to live button when scrolled
Log Browser
- Full-text search across all logs
- Filter by type, player, date range
- Pagination for large result sets
- Export to JSON or CSV
Player Profiles
- Minecraft avatar display (via Crafatar)
- Activity statistics per player
- Recent activity history
- Click any player name to view profile
REST API
POST /api/auth/token - Get JWT token
GET /api/logs - Query logs with filters
GET /api/logs/player/{name} - Logs for one player
GET /api/logs/search?q=term - Search log content
GET /api/stats - Statistics
JWT auth with rate limiting.
Requirements
- Paper 1.21+ or Folia
- Java 21+
Commands
/cclogger - Shows help
/cclogger reload - Reload config (requires cclogger.reload)
/cclogger count <word> [player] - Count word occurrences (requires cclogger.statistics)
/cclogger clear - Archive and clear logs (requires cclogger.admin)
Permissions
cclogger.* - Everything (default: OP)
cclogger.notify - Receive alerts (default: OP)
cclogger.exempt - Not logged (default: false)
cclogger.reload - Reload config (default: OP)
cclogger.statistics - Count command (default: OP)
cclogger.admin - Clear/archive (default: OP)
cclogger.web - Web API access (default: OP)
Setup
- Drop JAR in
plugins/
- Restart server
- Edit
plugins/CCLogger/config.yml
/cclogger reload
Default config works immediately. Change storage.type if you want something other than SQLite.
Config Example
storage:
type: sqlite # file, sqlite, mysql, mongodb, redis
privacy:
ip-logging: disabled
notifications:
enabled: true
chat-keywords:
- "hack"
- "cheat"
web:
enabled: false
port: 8080
Links
评论 0
登录后参与评分
还没有评论,来抢沙发吧