这里使用的版本为graylog4.2.10
1、一键安装graylog4.2.10,解压zip包,执行脚本就行
链接:https://pan.baidu.com/s/11U7GpBZ1B7PXR8pyWVcHNw?pwd=udln 
 提取码:udln
2、通过rsyslog采集系统日志,具体操作参考前面文章
GrayLog日志平台的基本使用-收集系统日志-CSDN博客
3、下载需要的安装包
Releases · P3TERX/GeoLite.mmdb · GitHub
GitHub - xkill/graylog_4.1_ssh: Graylog SSH parser and display


4、配置
(1)上传GeoIP地址库文件
GeoLite2-City.mmdb上传到GrayLog服务器的/etc/graylog/server目录中
 、
、
(2)启用GeoIP Resolver
system/configurations中最右下方Geo-Location Processor中 启用Geo-Location Processor

并在Message Processors Configuration中将GeoIP Resolver的顺序放在最下面 拖拽即可

(3)上传并安装graylog_4.1_ssh-main-content-pack



(4)、修改Pipeline SSH的extract_ssh_fields


rule "extract_ssh_fields"
 when
      has_field("message")
 then
     let msg = to_string($message.message);
     let msg2 = regex_replace("Invalid user", msg, "Invalid user by invalid user");
     let parsed = grok(pattern: "%{SSH}", value: msg2, only_named_captures: true);
     set_fields(parsed);
     rename_field("ssh_rip","remote_addr");
     rename_field("ssh_username","username");
 end 

(5)、模拟公网IP测试SSH登录失败
这里由于我在内网服务器上操作,可以ifconfig ens192:1起虚拟IP进行模拟

可以在SSH Dashboard的地图中看到效果




6、解决localhost显示问题

1、添加一个pipeline

2、创建Pipeline Rules

rule "Replace source with sending IP"
 when  
   has_field("message")
 then  
   set_field("source", to_string($message.gl2_remote_ip));
 end
3、把pipeline应用到stream中

4、在stage0中应用rules规则

当匹配到pipeline中的规则中,就按规则中语法进行处理
可以通过Throughput查看匹配到规则的吞吐量

验证:
