1. 程式人生 > >ELKStack之消息隊列

ELKStack之消息隊列

修改配置文件 ces key yum 技術分享 data red 生產 install

redis消息隊列

安裝redis

yum -y install redis

修改配置文件

修改ip

技術分享

後臺運行

技術分享

啟動

systemctl start redis

查看

lsof -i:6379

連接

redis-cli -h 10.13.85.9

cd /etc/logstash/conf.d/

vim redis.conf

input{
    stdin {}
}

output{
    redis{
    	host => "10.13.85.9"
	port => "6379"
	db => "6"
	data_type => "list"
	key => "demo"
    }
}

啟動

/opt/logstash/bin/logstash -f redis.conf

另外開一個窗口啟動redis連接

redis-cli -h 10.13.85.9

select 6

技術分享

驗證可以寫一個收集apache日誌的配置文件

vim apache.conf

input{
    file{
        path => "/var/log/httpd/access_log"
        start_position => "beginning"
    }
}
output{
    redis{
        host => "10.13.85.9"
        port => "6379"
        db => "6"
        data_type => "list"
        key => "apache-accesslog"
    }
}

啟動

/opt/logstash/bin/logstash -f apache.conf

技術分享

查看最好一行

技術分享

生產中可以在另外一臺服務器啟動一個logstash收集redis裏面的數據

在另外服務器上面

vim /etc/logstash/conf.d/indexer.conf

input{
    redis{
    	host => "10.13.85.9"
	port => "6379"
	db => "6"
	data_type => "list"
	key => "demo"
    }

}

output{
    stdout{
    	codec => rubydebug
    }
}

啟動如果成功了加filter處理apache

ELKStack之消息隊列