jsch


JSch read local log file


I am developing a tool that use JSch library to read log files from remote machine for log parsing and some other functionality. The code to read the log file is given below.
JSch jsch=new JSch();
Session session=jsch.getSession(user, host, 22);
session.setPassword(password);
session.setConfig("StrictHostKeyChecking", "no");
session.connect();
ChannelSftp sftp = (ChannelSftp) session.openChannel("sftp");
sftp.connect();
InputStream stream = null;
try {
//this will be changed to execute on a regular time interval
while (true) {
stream = sftp.get(rfile);
read(stream);
}
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
stream.close();
sftp.disconnect();
session.disconnect();
}
But, there is a chance that the tool will be deployed to the machine where the log is generated. So, my question is,
1) I suspect a performance issue using the sftp.get() as the log file will be read in a regular interval(eg. 5 mins). Any suggestion to improve performance here ?
2) whether JSch will have the same network overhead for reading files from the local machine similar to the remote machine.
3) If yes, is there any way to improve the performance if the log is reading from a local machine.
May be i can check the ip address of both the target and host machine before reading the log file. And if both are same i can read the log directly. But, could there be any better alternative?
Thanks,
nks

Related Links

How to interact with the script after its execution using Jsch
java jsch -executing multiple unix commands
How to get one stream from error stream and input stream when calling a script using JSCH
SFTP using jschexception verify false sometimes fails
how to increase the jsch buffer size?
The cipher 'aes256-cbc' is required, but it is not available
How to pause/resume procedure while/after upload file by ChannelSftp
jsch + running multiple command in shell after SU and then close channal
NGit/Nsch Generating SSH Keypair (c# Jgit)
Extract userInfo from JSCH stream
Running a Shell Script using java ( process Builder ) with a specific unix user
Java jsch and resuming file upload after interruption?
How to pass a variable through channel in Jsch?
How to handle passwords prompts in expectj
Retaining the last modified date while using ChannelSftp for file transfer
Is there a limit to how many channels can be open per session in JSch?

Categories

HOME
ionic-framework
deployment
oracle11g
isabelle
mockito
plot
cvs
v8
ezpublish
pivotal-cloud-foundry
upload
pheatmap
spring-kafka
kentor-authservices
remote-access
uitypeeditor
reactcsstransitiongroup
reactive-cocoa
django-cms
viewport
introduction
csrf-protection
wijmo
centos6.5
url-scheme
wpfdatagrid
xacml
replaceall
jspm
large-file-upload
yadcf
http-status-code-503
contact-form
siesta-swift
calibre
hybridauth
force-layout
suricata
scaffold
mixture-model
serverside-rendering
broadcastreceiver
reportingservices-2005
nxlog
modelmapper
angular2-meteor
fault
scrollable
network-flow
qsslsocket
dds
prolog-setof
svmlight
crypt
lync-client-sdk
watchconnectivity
nested-sets
storekit
markojs
pickadate
fadeout
yaws
maven-tomcat-plugin
teamcity-8.0
google-places
comobject
libressl
drawbitmap
tableau-online
microbenchmark
ios9.1
ami
asp.net-web-api-odata
xcode-6.2
java-metro-framework
flask-cors
hippomocks
gnu-smalltalk
quantlib-swig
inbox
html4
interface-orientation
ember-app-kit
newtonscript
boost-filesystem
zpt
jmock
cxxtest
modelstate
preference
privilege
phonon
sector
signal-handling

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App