# LOGSTASH\_Pull JDBC logs from cloud server to local using SSH key

**URL:** <https://discuss.elastic.co/t/logstash-pull-jdbc-logs-from-cloud-server-to-local-using-ssh-key/171965>\
**Category:** Logstash\
**Created:** [March 12, 2019, 1:54pm UTC](https://discuss.elastic.co/t/logstash-pull-jdbc-logs-from-cloud-server-to-local-using-ssh-key/171965 "2019-03-12T13:54:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![padma](https://avatars.discourse-cdn.com/v4/letter/p/ecc23a/32.png) [@padma](https://discuss.elastic.co/u/padma)\
**Post date:** [March 12, 2019, 1:54pm UTC](https://discuss.elastic.co/t/logstash-pull-jdbc-logs-from-cloud-server-to-local-using-ssh-key/171965/1 "2019-03-12T13:54:46Z")

</div>

How to pull the JDBC logs from the cloud server to local using ssh key

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [March 14, 2019, 12:18am UTC](https://discuss.elastic.co/t/logstash-pull-jdbc-logs-from-cloud-server-to-local-using-ssh-key/171965/2 "2019-03-14T00:18:54Z")

</div>

If your cloud server does not expose the appropriate ports for normal database connections to its public network interfaces, and you need to tunnel to your cloud server using SSH with key-based authentication, then you will need to create an SSH tunnel from your local machine to the cloud server that exposes a port from the server _as_ a port on a local interface, such as your loopback interface with ip `127.0.0.1`. This is called "local forwarding" and can be set up with ssh's `-L` flag:

> **-L** `[`_`bind_address`_`:]` _`port`_ `:` _`host`_ `:` _`hostport`_
> 
> Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side. This works by allocating a socket to listen to _port_ on the local side, optionally bound to the specified _bind\_address_ . Whenever a connection is made to this port, the connection is forwarded over the secure channel, and a connection is made to _host_ port _hostport_ from the remote machine. Port forwardings can also be specified in the configuration file. IPv6 addresses can be specified with an alternative syntax:  
> [_bind\_address_ /] _port_ / _host_ / _hostport_ or by enclosing the address in square brackets. Only the superuser can forward privileged ports. By default, the local port is bound in accordance with the **GatewayPorts** setting. However, an explicit _bind\_address_ may be used to bind the connection to a specific address. The _bind\_address_ of ''localhost'' indicates that the listening port be bound for local use only, while an empty address or '\*' indicates that the port should be available from all interfaces.  
> -- [man ssh](https://linux.die.net/man/1/ssh)

**_There are serious security implications here, as any user who has a route to that port on your local machine will also have access to the tunnelled port on your cloud server._**

---

<div class="post-metadata">

**Author:** ![padma](https://avatars.discourse-cdn.com/v4/letter/p/ecc23a/32.png) [@padma](https://discuss.elastic.co/u/padma)\
**Post date:** [March 19, 2019, 6:01am UTC](https://discuss.elastic.co/t/logstash-pull-jdbc-logs-from-cloud-server-to-local-using-ssh-key/171965/3 "2019-03-19T06:01:46Z")

</div>

Can you share e the sample config file for the above settings

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 16, 2019, 6:01am UTC](https://discuss.elastic.co/t/logstash-pull-jdbc-logs-from-cloud-server-to-local-using-ssh-key/171965/4 "2019-04-16T06:01:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
