SpringBoot集成Sentry日志收集-1 (Sentry安装)
Sentry
Sentry介绍 :
sentry是一个实时事件日志记录和聚合平台。它专门用于监视错误和提取执行适当的事后操作所需的所有信息, 而无需使用标准用户反馈循环的任何麻烦。
Sentry 是一个日志平台,分为客户端和服务端,客户端(目前客户端有Python, PHP,C#, Ruby等多种语言)就嵌入在你的应用程序中间,
程序出现异常就向服务端发送消息,服务端将消息记录到数据库中并提供一个web节目方便查看。Sentry由python编写,源码开放,性能卓越,
易于扩展,目前著名的用户有Disqus, Path, mozilla, Pinterest等
- Sentry为前后端报错系统 , 开发必备。
1. 安装 docker , docker-compose
sentry对docker也有版本的要求(注意: 如果版本不对应,安装时会遇到很多问题的)
docker 版本: 20.10.9
docker-compose 版本: 1.28.0
2. 安装sentry
- 拉取 onpremise 项目
[root@test sentry]# git clone https://github.com/getsentry/onpremise.git
正克隆到 'onpremise'...
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 1487 (delta 6), reused 8 (delta 2), pack-reused 1466
接收对象中: 100% (1487/1487), 424.38 KiB | 61.00 KiB/s, done.
处理 delta 中: 100% (808/808), done.
- 进入到拉好的项目里面 , 修改指定的配置,并进行安装
[root@test sentry]# cd onpremise/
[root@test onpremise]# ll
总用量 52
drwxr-xr-x 2 root root 24 1月 28 09:19 clickhouse
drwxr-xr-x 2 root root 45 1月 28 09:19 cron
-rw-r--r-- 1 root root 9140 1月 28 11:51 docker-compose.yml
drwxr-xr-x 2 root root 38 1月 28 09:19 geoip
drwxr-xr-x 2 root root 47 1月 28 09:19 install
-rwxr-xr-x 1 root root 15541 1月 28 09:19 install.sh
-rw-r--r-- 1 root root 4733 1月 28 09:19 LICENSE
drwxr-xr-x 2 root root 24 1月 28 09:19 nginx
-rw-r--r-- 1 root root 5384 1月 28 09:19 README.md
drwxr-xr-x 2 root root 32 1月 28 09:19 relay
drwxr-xr-x 2 root root 52 1月 28 09:19 scripts
drwxr-xr-x 2 root root 133 1月 28 09:19 sentry
drwxr-xr-x 2 root root 32 1月 28 09:19 symbolicator
-rwxr-xr-x 1 root root 4563 1月 28 09:19 test.sh
drwxr-xr-x 2 root root 24 1月 28 09:19 zookeeper
- 修改指定的配置信息
[root@test onpremise]# vim sentry/sentry.conf.example.py
在此文件中,增加如下两行配置信息
# This file is just Python, with a touch of Django which means
# you can inherit and tweak settings to your hearts content.
from sentry.conf.server import * # NOQA
## 增加此两行即可,避免后期使用时报错(!!!!!!!!!!!)
import socket
socket.setdefaulttimeout(20)
# Generously adapted from pynetlinux: https://git.io/JJmga
def get_internal_network():
import ctypes
import fcntl
import math
import socket
import struct
.................
- 开始安装,时间可能有点长 , 在安装的过程中 , 如果让你选择 yes/no 统一选择yes即可 , 在安装过程中会让你输入邮箱密码,来作为管理员的账号密码,
[root@test onpremise]# ./install.sh
- 脚本安装成功 , 那么开始启动容器
[root@test onpremise]# docker-compose up -d
- 容器启动成功 , 那么在浏览器通过
ip:9000
即可访问到登录页面