<p>I have an app (java, Spring boot) that runs in a container in openshift. The application needs to go to a third-party server to read the logs of another application. How can this be done? Can I mount the directory where the logs are stored to the container? Or do I need to use some Protocol to remotely access the file and read it?</p>
<p>A remote server is a normal Linux server. It runs an old application running as a jar. It writes logs to a local folder. An application that runs on a pod (with Linux) needs to read this file and parse it</p>

<p>There is a multiple way to do this.
If a continious access is needed :</p>
<ul>
<li>A <strong>Watcher</strong> access with polling events ( WatchService API )</li>
<li>A <strong>Stream Buffer</strong></li>
<li>File <strong>Observable</strong> with Java rx</li>
</ul>
<p>Then creating an <strong>NFS</strong> storage could be a possible way with exposing the remote logs and make it as a <strong>persistant volume</strong> is better for this approach.</p>
<p>Else, if the access is based on pollling the logs at for example a certain time during the day then a solution consist of using an <strong>FTP</strong> solution like <strong>Apache Commons FTP Client</strong>  or using an ssh client which have an <strong>SFTP</strong> implementation like  <a href="https://www.baeldung.com/java-file-sftp" rel="nofollow noreferrer">JSch</a> which is a native Java library.</p>
