If you want to run logstash-forwarder agent to run on your vm everytime it comes up you will have to jump through a lot of hoops :)
here are some of them ( hopefully this is all you will need)
Edit the logstash-forwarder.conf with server info and the cert, key files e.t.c (make sure you scp the cert and key file)
Edit the supervisor.conf with this in the end
here are some of them ( hopefully this is all you will need)
yum install git
git clone https://github.com/elasticsearch/logstash-forwarder.git
cd logstash-forwarder/
go build
gem install fpm pleaserun
make rpm
yum install rpm-build
make rpm
yum install logstash-forwarder-0.4.0-1.x86_64.rpm
vim /opt/logstash-forwarder/logstash-forwarder.conf
yum install supervisor
systemctl enable supervisord
echo_supervisord_conf > /etc/supervisord.conf
sudo /usr/bin/echo_supervisord_conf > supervisord.conf
vim supervisord.conf
sudo cp supervisord.conf /etc/supervisord.conf
sudo cp supervisord.conf /etc/supervisor.d/supervisord.conf
Edit the logstash-forwarder.conf with server info and the cert, key files e.t.c (make sure you scp the cert and key file)
{
"network": {
"servers": [ "serverip:port" ],
"ssl ca": "/opt/logstash-forwarder/ssl/logstash-forwarder.crt",
"ssl key": "/opt/logstash-forwarder/ssl/logstash-forwarder.key",
"timeout": 15
},
"files": [
{
"paths": ["/home/centos/ubtest.log"],
"fields": { "type": "staging" }
}
]
}
Edit the supervisor.conf with this in the end
[program:logstash-forwarder]
command=sudo /opt/logstash-forwarder/bin/logstash-forwarder -config=/opt/logstash-forwarder/logstash-forwarder.conf
stdout_logfile=/var/log/logstash-forwarder.log
stderr_logfile=/var/log/logstash-forwarder.err
autorestart=true
autostart=true
user=root
directory=/opt/logstash-forwarder