Run logstash forwarder and web as a daemon on ubuntu

990 Views Asked by At

I am currently using logstash-1.4.2. In which you don't get the standard monolithic or flat jar which used to be the case earlier. Now, i want to start the logstash forwarder as a service.

bin/logstash -f logforwareder.conf

Above command runs it in the foreground. So it gets killed everytime i close/exit the terminal.

Similarly, for the LogStash indexer how do i achieve the same.

  bin/logstash -f indexer.conf web

This command also kills indexer once terminal is closed.

1

There are 1 best solutions below

0
On

On ubuntu, don't forget to have your own configuration file at /etc/logstash-forwarder (without .conf).

{
  "network":
  {
     "servers": [
       "logstash.server.ip:5000"
     ],
     "ssl ca":
       "/etc/ssl/certs/logstash-forwarder.crt",
     "timeout": 15
  },
  "files": [
    {
      "paths": [
         "/var/log/apache2/access_web1.log",
         "/var/log/apache2/access_web2.log"
      ],
      "fields": {
         "type": "apache",
         "environment": "production"
      }
   }
  ]
}

You can check the script to see where is it looking for the config file:

vi /etc/init.d/logstash-forwarder