All Projects → EscapeLife → web-log-analyst

EscapeLife / web-log-analyst

Licence: MIT License
🐌 Nginx日志分析处理监控

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to web-log-analyst

grafana-dashboards
List of Grafana Dashboards 📺
Stars: ✭ 120 (+242.86%)
Mutual labels:  influxdb, grafana
ha-config-ataraxis
My Home Assistant Configs. If you like what you see, please ⭐️my repo. It would encourage me a lot 🤘
Stars: ✭ 146 (+317.14%)
Mutual labels:  influxdb, grafana
bounded-disturbances
A k6/.NET red/green load testing workshop
Stars: ✭ 39 (+11.43%)
Mutual labels:  influxdb, grafana
envsensor-observer-py
Python Bluetooth low energy observer example for OMRON Environment Sensor (2JCIE-BL01)
Stars: ✭ 31 (-11.43%)
Mutual labels:  influxdb, grafana
ruuvitag-demo
Demo of reading Bluetooth Low Energy sensor measurements of RuuviTag environmental sensors and feeding them to MQTT, a database and dashboards
Stars: ✭ 14 (-60%)
Mutual labels:  influxdb, grafana
docker-telegraf-influxdb-grafana
Docker Image with Telegraf, InfluxDB and Grafana
Stars: ✭ 17 (-51.43%)
Mutual labels:  influxdb, grafana
nfCollector
Collects Netflow version 1, 5, 6, 7, 9 & IPFIX & stores them on InfluxData time-series DB (InfluxDB)
Stars: ✭ 30 (-14.29%)
Mutual labels:  influxdb, grafana
rpi-monitoring-node
Automated installation of Grafana, Telegraf and influxdb for your Raspberry Pi
Stars: ✭ 18 (-48.57%)
Mutual labels:  influxdb, grafana
kotori
A flexible data historian based on InfluxDB, Grafana, MQTT and more. Free, open, simple.
Stars: ✭ 73 (+108.57%)
Mutual labels:  influxdb, grafana
darksky2influxdb
Stores wheather forcecast data from darkskyapi into a influxdb database
Stars: ✭ 21 (-40%)
Mutual labels:  influxdb, grafana
geostat
GeoStat, Python script for parsing Nginx and Apache logs files and getting GEO data from incoming IP's.
Stars: ✭ 50 (+42.86%)
Mutual labels:  influxdb, grafana
histou
Adds templates to Grafana in combination with nagflux
Stars: ✭ 33 (-5.71%)
Mutual labels:  influxdb, grafana
air-quality
Live dashboard for air quality in my home.
Stars: ✭ 70 (+100%)
Mutual labels:  influxdb, grafana
monitoring-rancher
🤠How to Set up Rancher Server Monitoring with TIG Stack?
Stars: ✭ 22 (-37.14%)
Mutual labels:  influxdb, grafana
ml-ops
Get your MLOps (Level 1) platform started and going fast.
Stars: ✭ 81 (+131.43%)
Mutual labels:  influxdb, grafana
telegraf-influxdb-grafana
TIG Stack
Stars: ✭ 30 (-14.29%)
Mutual labels:  influxdb, grafana
solar-logger
A datalogger for a solar inverter. Stores data in influxdb and displays it in grafana. Has load diverting capability, to use the inverter's excess power
Stars: ✭ 53 (+51.43%)
Mutual labels:  influxdb, grafana
formula1-telemetry-kafka
No description or website provided.
Stars: ✭ 99 (+182.86%)
Mutual labels:  influxdb, grafana
tilt-pitch
Simple replacement for the Tilt Hydrometer mobile apps and TiltPi with lots of features
Stars: ✭ 32 (-8.57%)
Mutual labels:  influxdb, grafana
microservices-observability
🎉 Microservices Observability - Log Aggregation, Distributed Tracking, Metrics
Stars: ✭ 40 (+14.29%)
Mutual labels:  influxdb, grafana

Raspi-X

web-log-analyst 🐌 Nginx日志分析处理监控

love_girlfriend love_girlfriend love_girlfriend

项目目录

1. 功能描述

小工具功能用途的简单描述

一个简单的日志分发、存储、监控、展示的小工具,当然你也可以将任何你关注的信息,集中到这里进行展示。其中 log_distribution.py 用来分发日志数据,变相的实现了多日志监控的效果;analyzer_threading.pyanalyzer_multiprocessing.py 是利用进程以及线程的特性,对日志进行了收集、聚合、发送的效果(在 python 中,threading 多线程都是运行在一个进程当中的,所以对于多核 CPU 并没有发挥其性能;相对而言,multiprocessing 多进程可以充分利用操作系统的性能)。将数据存储在 influxdb 流式数据库中,并利用 grafana 进行`展示,当然这里你也可以使用其他的数据库展示工具都是可以的。

2. 项目流程图

通过流程图直观的解释项目的分析过程

Nginx 日志分析处理监控流程图

3.模块分析过程

注释:没有提供所需的 Nginx 日志文件,使用时需要结合自己的真实适用场景进行合理规划。

3.1 解析日志文件

对于 Web 服务器的日志输出,是由我们指定的,既可以更多的记录站点的信息也可以大致的做一下记录。当然,最重要信息肯定也是必不可少的。如下,列出了比较重要的日志记录信息。

  • IP 地址
  • 用户访问时间戳
  • 请求方式
  • URL 地址
  • 浏览器版本
  • 服务器返回状态
  • 返回字节长度
  • referer
  • UserAgent

3.2 分析日志文件

通过对于 Nginx 日志的分析,我们可以得到很多东西,不只是我下面表格列出的这几条。分析得到的结果,可以有助于我们来优化网站性能、统计网站访问量以及实时展示有很大的帮助。

编号 获取到的内容 如果统计 如何展示
1 平均时间的流量 sum line char
2 平均响应时间 sum line char
3 top 10 URL count bar chat
4 top 10 IP count bar char
5 top 10 UserAgent count bar char
6 响应状态的分布 group by pie chat or stack chat
7 UserAgent 的分布 group by pie chat or stack chat
8 HTTP 版本的分布 group by pie chat or stack chat

3.3 数据结构

为了便于理解,下图实例了一下,对应的数据结构便于理解和学习。

数据结构

3.4 展示日志文件

3.4.1 influxdb

用途

  • InfluxDBGo 语言编写的一个开源分布式时序、事件和指标数据库,和传统是数据库相比有不少不同的地方
  • 类似的数据库有 ElasticsearchGraphite
  • 一般用来储存实时数据,配合一套 UI 界面来展示信息

安装

# 配置yum安装源
cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF

# 安装influxdb以及启动
sudo yum install influxdb
sudo systemctl start influxdb

# 在浏览器中输入 localhost:8083 即可进入web管理页面

3.4.2 grafana

用途

  • 图形化动态展示

安装

# 配置yum安装源
[grafana]
cat <<EOF | sudo tee /etc/yum.repos.d/grafana.repo
name=grafana
baseurl=https://packagecloud.io/grafana/stable/el/6/$basearch
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
EOF

# 安装influxdb以及启动
sudo yum install grafana
sudo systemctl start grafana-server
sudo systemctl status grafana-server

# 在浏览器中输入 localhost:3000 即可进入web管理页面

4. 效果展示

influxdb 存储数据

influxdb存储数据

grafana 监控展示

grafana监控展示

5. 快速构建

使用 Docker 进行快速构建

# 生成数据
$ python3 script/log_distribution.py data/grpc.access.log egg/1.log egg/2.log egg/3.log

# 解析数据并推送到influxdb里面
$ python3 script/analyzer_multiprocessing.py egg/1.log egg/2.log egg/3.log
$ python3 script/analyzer_threading.py egg/1.log egg/2.log egg/3.log

6. 联系方式

WX

Footnotes

  1. This is my nickname.

  2. This is my company address.

  3. This is my public mailbox.

  4. This is my blog.

  5. The open source protocol used by the repository.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].