# 原因# 方法
1、下载最新版编译好的`Log4j`的jar包2、解压后,找到如下四个文件,并上传到服务器3、删除服务器上低版本的`Log4j`的jar包4、将最新版Log4j的jar包复制过去5、重启`ElasticSearch`服务即可 # 参考
# 原因
项目中使用了ElasticSearch ,版本为7.13.2,其中用到的Log4j的版本为2.11.1,该版本的Log4j存在漏洞,故需要升级Log4j;
# 方法 1、下载最新版编译好的Log4j的jar包下载地址: https://downloads.apache.org/logging/log4j/2.17.1/
2、解压后,找到如下四个文件,并上传到服务器log4j-1.2-api-2.17.1.jarlog4j-api-2.17.1.jarlog4j-core-2.17.1.jarlog4j-slf4j-impl-2.17.1.jar
3、删除服务器上低版本的Log4j的jar包rm -rf /usr/share/elasticsearch/lib/log4j-api-2.11.1.jarrm -rf /usr/share/elasticsearch/lib/log4j-core-2.11.1.jarrm -rf /usr/share/elasticsearch/modules/repository-url/log4j-1.2-api-2.11.1.jarrm -rf /usr/share/elasticsearch/modules/x-pack-core/log4j-1.2-api-2.11.1.jarrm -rf /usr/share/elasticsearch/modules/x-pack-identity-provider/log4j-slf4j-impl-2.11.1.jarrm -rf /usr/share/elasticsearch/modules/x-pack-security/log4j-slf4j-impl-2.11.1.jar
4、将最新版Log4j的jar包复制过去cp log4j-api-2.17.1.jar /usr/share/elasticsearch/lib/cp log4j-core-2.17.1.jar /usr/share/elasticsearch/lib/cp log4j-1.2-api-2.17.1.jar /usr/share/elasticsearch/modules/repository-url/cp log4j-1.2-api-2.17.1.jar /usr/share/elasticsearch/modules/x-pack-core/cp log4j-slf4j-impl-2.17.1.jar /usr/share/elasticsearch/modules/x-pack-identity-provider/cp log4j-slf4j-impl-2.17.1.jar /usr/share/elasticsearch/modules/x-pack-security/
5、重启ElasticSearch服务即可 # 参考https://developer.aliyun.com/article/843078