1. filebeat启动
### 后台启动生成日志文件,进入file-*.*.*目录下
nohup ./filebeat -e -c filebeat.yml -d "Publish" & > nohup.out
### 后台启动不生成日志
./filebeat -e -c filebeat.yml -d "Publish" >/dev/null 2>&1 &
-
关键在于最后的 >/dev/null 2>&1 部分,/dev/null是一个虚拟的空设备(类似物理中的黑洞),任何输出信息被重定向到该设备后,将会石沉大海
-
/dev/null 表示将标准输出信息重定向到"黑洞"
-
2>&1 表示将标准错误重定向到标准输出(由于标准输出已经定向到“黑洞”了,即:标准输出此时也是"黑洞",再将标准错误输出定向到标准输出,相当于错误输出也被定向至“黑洞”)
2. logstash 启动
### 后台启动生成日志文件,进入logstash-*.*.*目录下
### 我这里为了方便把logstash-sample.conf 文件放在了bin目录下
nohup ./bin/logstash -f bin/logstash-sample.conf & > nohup.out
### 后台启动不生成日志
./bin/logstash -f bin/logstash-sample.conf >/dev/null 2>&1 &
3. 启动elasticsearch
### 后台启动生成日志,进入elastic-*.*.*/bin 目录下
nohup ./elasticsearch & > nohup.out
### 后台启动不生成日志
./elasticsearch >/dev/null 2>&1 &
ELK环境搭建:https://blog.csdn.net/it1993/article/details/104611543