Graylog
Graylog 是与 ELK 可以相提并论的一款集中式日志管理方案,支持数据收集、检索、可视化
Graylog 架构
- Graylog 负责接收来自各种设备和应用的日志,并为用户提供 Web 访问接口。
- Elasticsearch 用于索引和保存 Graylog 接收到的日志。
- MongoDB 负责保存 Graylog 自身的配置信息。
实操
安装Openjdk
- yum -y install java-1.8.0-openjdk-headless.x86_64
- java -version
安装Mongodb
- 配置Mongndb的yum源
- vim /etc/yum.repos.d/mongodb-org-4-0.repo
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb- org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
- yum repolist - 安装Mongdb并启动服务设置为开机自启动
- yum -y install mongodb-org
- systemctl enable mongod.service
- systemctl start mongod.service
- systemctl status mongod.service
安装Elasticsearch
- rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
- vim /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-6.x]
name=Elasticsearch repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/oss-6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
- yum repolist
- yum -y install elasticsearch-oss
- vim /etc/elasticsearch/elasticsearch.yml
cluster.name: graylog
action.auto_create_index: false
- systemctl enable elasticsearch.service
- systemctl start elasticsearch.service
- systemctl status elasticsearch.service
安装Graylog
- rpm -Uvh https://packages.graylog2.org/repo/packages/graylog-3.0-repository_latest.rpm
- yum -y install graylog-server
- yum -y install epel-release
- yum -y install pwgen
- pwgen -N 1 -s 96
# 注意上一条命令执行之后会有一个字符串的密码出来(1)
- echo -n "Enter Password: " && head -1 </dev/stdin | tr -d '\n' | sha256sum | cut -d" " -f1
# 注意上一条命令执行之后会有一个字符串的密码出来(2)
- vim /etc/graylog/server/server.conf
password_secret = # 注意上一条命令执行之后会有一个字符串的密码出来(1)
root_username = admin
root_password_sha2 = # 注意上一条命令执行之后会有一个字符串的密码出来(2)
root_timezone = Asia/Shanghai
http_bind_address = 127.0.0.1:9000
http_publish_uri = http://自己的IP:9000/
http_enable_cors = true
http_enable_gzip = true
http_enable_tls = false
elasticsearch_hosts = http://127.0.0.1:9200 - systemctl enable graylog-server.service
- systemctl start graylog-server.service
- systemctl status graylog-server.service
使用Nginx做反向代理
- yum -y install nginx
- echo '' > /etc/nginx/nginx.conf
- vim /etc/nginx/nginx.conf
user nobody;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
client_max_body_size 100m;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_min_length 256;
gzip_buffers 16 8k;
gzip_comp_level 6;
gzip_vary on;
gzip_types
text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
text/javascript application/javascript application/x-javascript
text/x-json application/json application/x-web-app-manifest+json
text/css text/plain text/x-component
font/opentype application/x-font-ttf application/vnd.ms-fontobject
image/x-icon;
include /etc/nginx/conf.d/*.conf;
}
[root@dev-of-runfa-33 ~]# vim /etc/nginx/conf.d/www.conf
server
{
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name 自己主机的IP;
location /graylog/
{
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Graylog-Server-URL http://$server_name/graylog/;
rewrite ^/graylog/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:9000;
}
}
- systemctl enable nginx
- systemctl start nginx
- systemctl status nginx
测试
# 主页 : http://自己主机的IP/graylog
# REST API 主页: http://自己主机的IPgraylog/api
Graylog的更多相关文章
- CentOS 搭建Graylog集群详解
1. Graylog2 简介 Graylog 是一个简单易用.功能较全面的日志管理工具,相比 ELK 组合, 优点: 部署维护简单,一体化解决方案,不像ELK三个独立系统集成. 查相比ES json语 ...
- 部署 Graylog 日志系统 - 每天5分钟玩转 Docker 容器技术(92)
Graylog 是与 ELK 可以相提并论的一款集中式日志管理方案,支持数据收集.检索.可视化 Dashboard.本节将实践用 Graylog 来管理 Docker 日志. Graylog 架构 G ...
- 如何用 Graylog 管理日志?- 每天5分钟玩转 Docker 容器技术(93)
上一节已经部署好了 Graylog,现在学习如何用它来管理日志. 首先启动测试容器. docker run -d \ --log-driver=gelf \ --log-opt gelf-addres ...
- GrayLog + Logspout + Docker 实现分布式日志聚合
前提条件:你的服务器上已经安装了Docker和Docker Compose 一.安装GrayLog(Docker方式) version: '2' services: mongodb: image: m ...
- SpringBoot使用Graylog日志收集
本文介绍SpringBoot如何使用Graylog日志收集. 1.Graylog介绍 Graylog是一个生产级别的日志收集系统,集成Mongo和Elasticsearch进行日志收集.其中Mongo ...
- 使用 opendistro for elasticsearch 做为graylog的后端存储
graylog 是一个很不错的日志分析.收集.报警平台,包好了丰富的插件,同时内部的架构设计很不错 input 组件很多,使用stream.pipeline可以方便的进行数据处理,可以同时3.0 对于 ...
- ASP.NET Core中使用Graylog记录日志
以下基于.NET Core 2.1 定义GrayLog日志记录中间件: 中间件代码: public class GrayLogMiddleware { private readonly Request ...
- Graylog日志管理系统---搜索查询方法使用简介
Elasticsearch 是一个基于 Lucene 构建的开源.分布式.提供 RESTful 接口的全文搜索引擎 一.Search页面的各位置功能介绍: 1.日志搜索的时间范围 为了使用方便,预设有 ...
- ASP.NET Core 中使用 GrayLog 记录日志
使用 UDP 协议发送日志 自定义好的查询 key 存储数据,尽量不要使用 graylog2-server 服务端格式化日志再存储 Ubuntu 安装服务端 sudo apt-get update & ...
- Log4net 日志传到 graylog监控
graylog是java的一个日志监控插件.存储用的是mongoDB,效率还是挺高的.不过嘛,文档太少了,安装和配置都很不容易. 官网:http://www.graylog.org/ 在graylog ...
随机推荐
- hiho1482出勤记录II(string类字符串中查找字符串,库函数的应用)
string类中有很多好用的函数,这里介绍在string类字符串中查找字符串的函数. string类字符串中查找字符串一般可以用: 1.s.find(s1)函数,从前往后查找与目标字符串匹配的第一个位 ...
- LIS是什么?【标本分拣】
接之前[LIS是什么?]中,提到几点需要补充描述的部分. Ⅰ.标本分管处理 标本的分管处理,在医院和第三方实验室有多种叫法,例如:分拣.合管等等.这里我称之为分拣,分拣实际上分为两个部分:系统中标本分 ...
- C++ DirectShow读取摄像头后然后保存图像数据
#include <stdio.h> #include "camerads.h" #include <highgui.h> const char *g_sz ...
- chan-vese模型
Python--level set (水平集)和 chan-vese模型 2018年08月28日 10:51:54 GlassySky0816 阅读数:1604 版权声明:本文为博主原创文章,未 ...
- Python中Opencv和PIL.Image读取图片的差异对比
近日,在进行深度学习进行推理的时候,发现不管怎么样都得不出正确的结果,再仔细和正确的代码进行对比了后发现原来是Python中不同的库读取的图片数组是有差异的. image = np.array(Ima ...
- 使用super调用被子类覆盖的父类方法
1.没有super方法 /* * 子类方法覆盖父类方法,用super方法可以调用父类被覆盖的方法 */ class fruit{ public fruit() { System.out.println ...
- dp--分组背包 P1757 通天之分组背包
题目背景 直达通天路·小A历险记第二篇 题目描述 自01背包问世之后,小A对此深感兴趣.一天,小A去远游,却发现他的背包不同于01背包,他的物品大致可分为k组,每组中的物品相互冲突,现在,他想知道最大 ...
- android机器时间不同步导致网络请求出错
转自: https://blog.csdn.net/DeMonliuhui/article/details/82226601 获取网页时间代替系统时间 根据下列代码,我们就可以获取任何一个网址的时间( ...
- HDU 3018 欧拉回路
HDU - 3018 Ant Country consist of N towns.There are M roads connecting the towns. Ant Tony,together ...
- kotlin黑马影音项目学习笔记
1.包布局 --------model--------presenter----------------impl----------------interf--------view--------ui ...