0

I am connecting to a remote host via ssh login and running logstash by the following command

$./logstash -f first-pipeline.conf 

However, after I logout from the server, the logstash stops running. How to enable it to keep running even after I logout. Thanks.

SameeraR
  • 415
  • 1
  • 6
  • 19
  • Run it with nohup > http://stackoverflow.com/questions/10408816/how-do-i-use-the-nohup-command-without-getting-nohup-out – Filip Jun 10 '16 at 08:50
  • Hi can you provide the command to run it in nohup? I tried nohup ./logstash -f first-pipeline.conf. But didn't work – SameeraR Jun 10 '16 at 08:57
  • ```$nohup logstash -f ~/logstash/pipeline.conf &``` but I've also tested and it worked if you're running with the agent argument like so ```$ logstash agent -f ~/logstash/pipeline.conf```. Let me know if running as agent works for you too... – Filip Jun 10 '16 at 09:09

2 Answers2

1

Another approach is to use the screen command which can be very useful for this.

First you open your SSH session, then type screen at the prompt. That opens a new session in which you can run your logstash command.

When it runs, you simply press Ctrl+a d in order to detach your self from that screen and you can safely logout.

Whenever you log back into your SSH session, you enter screen -r and you will get back into your previous session where logstash was started.

You can create as many "screens" as you wish to start many different processes at different times.

Also see this comparison between using nohup and screen

Community
  • 1
  • 1
Val
  • 207,596
  • 13
  • 358
  • 360
0

Just run it as an agent $ logstash agent -f ~/logstash/pipeline.conf

Filip
  • 1,214
  • 10
  • 19