这个项目能做什么

## 概述 **Nginx Access Log Detections Mod** 是 Powerpipe 的一个扩展模块,内置预构建的 SQL 检测和交互式仪表板,用于分析 Nginx 访问日志。通过将 Powerpipe 与 Tailpipe CLI(及其 Nginx 插件)配合使用,您可以收集日志数据、运行安全导向的基准测试,并实时可视化活动情况。 ## 主要功能 - 使用 Tailpipe 的 file 数据源进行**日志收集**,自动回填最近 7 天的数据并进行增量更新。 - **基于 SQL 的检测规则**,可发现可疑模式、OWASP 相关问题及其他安全洞察。 - 提供活动概览、请求趋势和基准测试结果的**即用型仪表板**。 - 通过 `powerpipe benchmark` 命令支持**终端基准测试**,便于快速生成报告。 - 通过 `powerpipe server` 启动**本地服务器**,在 `http://localhost:9033` 托管仪表板。 ## 快速开始 1. **安装 Powerpipe**(brew:`brew install turbot/tap/powerpipe`)。 2. **安装该模块**: ```sh mkdir dashboards && cd dashboards powerpipe mod install github.com/turbot/tailpipe-mod-nginx-access-log-detections ``` 3. **安装 Tailpipe 和 Nginx 插件**: ```sh brew install turbot/tap/tailpipe tailpipe plugin install nginx ``` 4. **配置日志数据源**(示例 `~/.tailpipe/config/nginx.tpc`): ```hcl partition "nginx_access_log" "test" { source "file" { paths = ["/path/to/nginx_access_logs"] file_layout = "%{DATA}.log" } } ``` 5. **收集日志**: ```sh tailpipe collect nginx_access_log ``` 使用 `--from` 指定起始日期或相对时间(例如 `T-60d`)。 6. **启动仪表板服务器**: ```sh powerpipe server ``` 在浏览器中打开 `http://localhost:9033` 即可浏览仪表板。 7. **在终端中运行基准测试**: ```sh powerpipe benchmark list powerpipe benchmark run nginx_access_log_detections.benchmark.access_log_detections ``` ## 文档与资源 - 仪表板:https://hub.powerpipe.io/mods/turbot/tailpipe-mod-nginx-access-log-detections/dashboards - 基准测试与检测规则:https://hub.powerpipe.io/mods/turbot/tailpipe-mod-nginx-access-log-detections/benchmarks - Tailpipe 文档:https://tailpipe.io/docs/reference/cli/collect ## 许可证与贡献 本项目采用 Apache 2.0 许可证发布。欢迎通过 GitHub 仓库做出贡献,并提供行为准则。欢迎加入 Slack 社区(`#tailpipe` 和 `#powerpipe`)。 ## 应用场景 - **安全团队**可以快速检测 Nginx 日志中的异常请求模式或 OWASP 违规。 - **运维团队**无需自建管道,即可监控流量趋势和性能指标。 - **开发人员**可以将基于日志的告警集成到 CI/CD 或事件响应工作流中。 该模块自包含、在本地运行,仅需 Powerpipe 和 Tailpipe 二进制文件,适合部署于私有化监控环境。