查询和分析阿里云 SLS 日志,支持 AI 智能分析
全文搜索:
• * - 查询所有日志
• ERROR - 搜索包含 ERROR 的日志
• ERROR and timeout - 同时包含两个关键词
• ERROR or WARNING - 包含任一关键词
• ERROR not success - 包含 ERROR 但不包含 success
SQL 分析语法(需要字段索引):
• * | where level = "ERROR" - 筛选 level 字段
• * | where level in ("ERROR", "WARNING") - 多个值
• * | where status >= 500 - 数值比较
| 时间 | 级别 | 应用 | Logstore | 消息 |
|---|---|---|---|---|
| {{ log.time }} | {{ log.level }} | {{ log.app_name }} | {{ log._logstore || '-' }} | {{ log.message }} |
{{ result.summary }}
原始日志:
{{ anomaly.sample }}
可能原因: {{ anomaly.possible_cause }}
建议: {{ anomaly.suggestion }}
{{ result.code_analysis.output }}
排查失败: {{ result.code_analysis.error }}
| ID | 时间范围 | 模式 | 日志数 | 状态 | 创建时间 | 操作 |
|---|---|---|---|---|---|---|
| #{{ report.id }} | {{ report.from_time }} ~ {{ report.to_time }} | {{ report.mode }} | {{ report.total_logs }} | {{ getStatusText(report.status) }} | {{ report.created_at }} |
每天凌晨 2 点自动分析过去 24 小时的 ERROR 日志并推送到钉钉
每 4 小时自动分析过去 6 小时的 ERROR 日志并推送到钉钉
注意:需要配置 Laravel 调度器才能生效。请确保服务器已配置 cron 任务:
* * * * * cd /path/to/project && php artisan schedule:run >> /dev/null 2>&1
同时需要启动队列处理器来执行后台任务:
php artisan queue:work