0

I am first downloading a config file locally then I have to push that file into logstash server in the path - /etc/logstash/conf.d

const deployLogstash =  function(req , res , next){

    clientscp.scp('./config-files/15287774.conf', {
        host: '172.30.74.250',
       port:5000,
        username: 'ubuntu',
        path: 'root@vm2:/etc/logstash/conf.d/newconfig.conf'
    }, function(err,success) {
        if(err){
        console.log("files failed to upload in remote server"+err);
        }
        else{
            console.log("files uploaded to remote server")
        }
    });
}

And this is the console.log

 serverError: connect ECONNREFUSED 172.30.74.250:5000

Is there any way I could transfer config files to that path?Please help me!

leandrojmp
  • 7,082
  • 2
  • 19
  • 24
  • Can you explain what you are trying to do? If you want to put a file inside `/etc/logstash/conf.d`, you need to use scp or ssh into the server and paste the file, making a request to elasticsearch has nothing to do with deploying files in a server. – leandrojmp Jan 27 '22 at 13:51
  • Hii @leandrojmp, yes i corrected the code and I am using scp client but now, I am getting serverError: connect ECONNREFUSED 172.30.74.250:5000. The logstash server is up and running I am not sure whats wrong – Nikeeta kurrey Jan 28 '22 at 10:16
  • 1
    SCP uses the same port as SSH, which is port 22 per default, you want to put a file in a directory on a remote server, this has no relation to Logstash or Elasticsearch. Check the link in the Answer below, this should put you in the right direction. – leandrojmp Jan 28 '22 at 12:42

1 Answers1

0

Adding to what @leandrojmp has already mentioned

The URI parameter you're using is of elasticsearch i.e. <hostname>:9200(elasticsearch's port) which meant for sending the contents of a files over elasticsearch indexes as events(termed as documents in Elastic-stack's terminology) But based on the information you've provided, I assume you're trying to upload a config file to your logstash's server directory.

You might wanna read about multer for uploading Files to remote server using multer-sftp, scp, ssh together as mentioned here in this link

Ankit
  • 599
  • 2
  • 11