当前位置:网站首页>Sentry log management system installation and use tutorial
Sentry log management system installation and use tutorial
2022-07-28 08:58:00 【Brother Xing plays with the clouds】
Sentry Is an open source real-time error reporting tool , Support web Front and rear ends 、 Mobile apps and games , Support Python、OC、Java、Go、Node、Django、RoR And other mainstream programming languages and frameworks , It also provides GitHub、Slack、Trello Integration of common development tools .
github Address
One 、 Environmental preparation
Environmental Science | explain |
|---|---|
Ubuntu16.04 | ip: 10.211.55.14 |
Two 、 Install prerequisites
1. install PostgreSQL
1. apt install
sudo apt-get -y install postgresql postgresql-contrib
2. modify Postgres The character's password
> sudo su > su - postgres > psql
Input :
postgres =# \password # Change the current user password Enter new password: Enter it again: postgres =# \q # sign out
function exit Leave postgres user
2. install redis
1. install
> sudo wget http://download.redis.io/releases/redis-3.2.6.tar.gz > sudo tar -zxvf redis-3.2.6.tar.gz > sudo cp -rf redis-3.2.6 /usr/local/redis > cd /usr/local/redis > sudo apt install gcc > sudo make > sudo make install
If you are prompted make test, Then input. make test
2. start-up
function redis-server start-up redis
3. install python, pip, And other environments
1. Install system components
sudo apt install python-setuptools python-dev libxslt1-dev gcc libffi-dev libjpeg-dev libxml2-dev libxslt-dev libyaml-dev libpq-dev
2. install pip
download get-pip.py
> wget "https://bootstrap.pypa.io/get-pip.py" > sudo python get-pip.py
3. install python library
> pip install -U virtualenv
3、 ... and 、 install sentry
1. Creating a virtual environment
> sudo mkdir /var/www > sudo chmod -R 777 /var/www > cd /var/www/ > mkdir sentry > cd sentry > virtualenv venv
2. install sentry
> source venv/bin/activate > pip install -U sentry > sentry Usage: sentry [OPTIONS] COMMAND [ARGS]...
Sentry is cross-platform crash reporting built with love.
The configuration file is looked up in the `~/.sentry` config directory but this can be overridden with the `SENTRY_CONF` environment variable or be explicitly provided through the `--config` parameter.
Options: --config PATH Path to configuration files. --version Show the version and exit. --help Show this message and exit.
Commands: celery DEPRECATED see `sentry run` instead. cleanup Delete a portion of trailing data based on... config Manage runtime config options. createuser Create a new user. devserver Starts a lightweight web server for... django Execute Django subcommands. dsym Manage system symbols in Sentry. export Exports core metadata for the Sentry... files Manage files from filestore. help Show this message and exit. import Imports data from a Sentry export. init Initialize new configuration directory. plugins Manage Sentry plugins. queues Manage Sentry queues. repair Attempt to repair any invalid data. run Run a service. shell Run a Python interactive interpreter. start DEPRECATED see `sentry run` instead. tsdb Tools for interacting with the time series... upgrade Perform any pending database migrations and...
Four 、 To configure sentry
1. initialization
sentry init Profile path
> sentry init /var/www/sentry/conf
2. modify postgreSQL Your connection account and password
open /var/www/sentry/conf/sentry.conf.py
Revise the following paragraph
DATABASES = { 'default': { 'ENGINE': 'sentry.db.postgres', 'NAME': 'sentry', 'USER': 'postgres', 'PASSWORD': '123123', # Just installed postgreSQL After you set the password 'HOST': '', 'PORT': '', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': False, } }
3. Initialize data and create users
> createdb -E utf-8 sentry
If you are prompted createdb: could not connect to database template1: FATAL: role "lin" does not exist
Then switch to postgre User execution
perform
SENTRY_CONF=/var/www/sentry/conf/ sentry upgrade
If you are prompted OperationalError: FATAL: Peer authentication failed for user "postgres"
Solution : 1.sudo vim /etc/postgresql/9.5/main/pg_hba.conf 2. modify
local all postgres peer
TYPE DATABASE USER ADDRESS METHOD
"local" is for Unix domain socket connections only
local all all peer
IPv4 local connections:
host all all 127.0.0.1/32 md5
IPv6 local connections:
host all all ::1/128 md5
by
local all postgres md5
TYPE DATABASE USER ADDRESS METHOD
"local" is for Unix domain socket connections only
local all all peer
IPv4 local connections:
host all all 127.0.0.1/32 md5
IPv6 local connections:
host all all ::1/128 md5
3. restart postgresql
sudo service postgresql restart
Re execution
SENTRY_CONF=/var/www/sentry/conf/ sentry upgrade
If you are prompted `sentry.exceptions.InvalidConfiguration: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.`
Solution : 1. Get into redis redis-cli 2. perform
config set stop-writes-on-bgsave-error no
Re execution
Re execution SENTRY_CONF=/var/www/sentry/conf/ sentry upgrade
After this step is completed, you may be prompted whether to create users , Then create users as required , If there is no prompt, execute the following statement to create
SENTRY_CONF=/var/www/sentry/conf/ sentry createuser
## 5、 ... and 、 Operation service
SENTRY_CONF=/var/www/sentry/conf/ sentry run web # function web service SENTRY_CONF=/var/www/sentry/conf/ sentry run worker # Run the log collection process
SENTRY_CONF=/var/www/sentry/conf/ sentry run cron # start-up cron process
6、 ... and 、 Configuration items 1. Browser open sentry Of web management , http://ip:9000 2. Enter the password of the account you just set 3. Click on New Project Create a project 4. Platform selection php, Enter the name of the project , Click Create 5. The jump page will show the connection code 6. Test error
<?php require_once 'vendor/autoload.php'; Raven_Autoloader::register();
Replace here with your own project id, On the page showing connection help
$client = new Raven_Client('http://f2c047b856bb41fcbf486f467b7fcf5b:[email protected]:9000/1');
$error_handler = new Raven_ErrorHandler($client); $error_handler->registerExceptionHandler(); $error_handler->registerErrorHandler(); $error_handler->registerShutdownFunction();
set_error_handler(array($error_handler, 'handleError')); set_exception_handler(array($error_handler, 'handleException'));
$client->captureMessage(" An error has occurred here ");
$i = 1 / 0;
After running , see web End , You will see the error transmitted back .
边栏推荐
猜你喜欢

Flink window & time principle

Source code analysis of linkedblockingqueue

Vk1620 temperature controller / smart meter LED digital display driver chip 3/4-wire interface with built-in RC oscillator to provide technical support

Different HR labels

象棋机器人夹伤7岁男孩手指,软件测试工程师的锅?我笑了。。。

我来教你如何组装一个注册中心?

Why setting application.targetframerate doesn't work

No one wants to tell the truth about kubernetes secret

Data fabric, next air outlet?

Win the bid! Nantah general gbase 8s won the bid for the 2022 database framework project of NARI Group
随机推荐
MDM数据质量应用说明
Oracle SQL problems
I use SqlClient normally, and dlink submission will report this error. What should I do?
Alibaba technology has four sides + intersection +hr, and successfully got the offer. Can't double non undergraduate students enter the big factory?
Flink Window&Time 原理
为什么 ThreadLocal 可以做到线程隔离?
Eight ways to solve EMC and EMI conducted interference
Two dimensional array and operation
Analysis and recurrence of network security vulnerabilities
Data fabric, next air outlet?
Go synergy
Huid learning 7: Hudi and Flink integration
You're not still using xshell, are you? This open source terminal tool is yyds!
置顶各大平台,22版面试核心知识解析笔记,强势上榜
SQL server time field sorting
【单细胞高级绘图】07.KEGG富集结果展示
Redis 基本知识,快来回顾一下
oracle sql 问题
Div tags and span Tags
Day112. Shangyitong: Mobile verification code login function