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

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?
How to read JSch command output?

Categories

HOME
atom-editor
listview
debugging
oracle11g
tizen
dictionary
comparison
react-router
octobercms
cvs
maven-3
azure-storage-tables
slick-slider
gorm
communication
here-api
windows-phone-7
decimal
facebook-page
pugjs
contextmenu
google-cloud-speech
amazonsellercentral
mps
tibco-mdm
icloud-api
facet
fgetcsv
fluentvalidation
strncpy
assistant
log4js-node
large-file-upload
vision
tasklet
srcset
gsoap
media-queries
twilio-api
.net-4.0
data-manipulation
google-qpx-express-api
column-family
caret
stringtemplate
form-data
sequential
io-redirection
file-format
dynamics-crm-2013
android-browser
mapzen
reactive-cocoa-5
node-sass
eclipse-gef
logfiles
celery-task
pebble-watch
svmlight
zendesk-app
time-and-attendance
visual-c++-2008
static-ip-address
database-optimization
multi-level
skobbler-maps
xml-attribute
pagedlist
blackberry-10
ubuntu-10.04
hover-over
wso2cloud
cyclomatic-complexity
iis-arr
wyam
ios9.1
c3
codeigniter-url
preferences
onactivityresult
yorick
message-driven-bean
java.nio.file
fmod
prettify
c18
farseer
runtime.exec
coverflow
shellexecute
android-screen-support
dsn
bubble-chart
work-stealing
subscript
deobfuscation
javax.script
self-extracting
winbugs14
imac
lang
pascal-fc
thread-local-storage
zune
rtml

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App