Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to connect to the linux machine with WinSCP(command line) from Windows. and I want to get logs.

There are logs in linux machine

/var/log/application/
090701.log
090702.log
090703.log
090704.log
090705.log

winscp sftp://account:pass@machine:22 How to get logs efficiently?

share|improve this question

3 Answers 3

If you're using scripting I think it's time for you to read the WinSCP documentation. Last time I looked it contained examples that show exactly how to do what you want.

Of course if you're using the GUI just drag them over to your Windows folders within the WinSCP interface.

share|improve this answer
1  
Thank you so much!!!!. I have to read the documentation –  freddiefujiwra Jun 30 '09 at 12:30
1  
It's always a good starting point. ;) –  John Gardeniers Jun 30 '09 at 12:51

I have a similar solution using winscp scripting, mine looks like this:

winscp Script:

option batch continue
option confirm off
open logs:*******@10.x.x.x
synchronize remote "c:\daily_logs\*" ./81/
synchronize remote "c:\daily_logs\" ./81/
close
exit

I use iCronService, which works on every version of windows I have tried it on, including x64 based ones, and this is what my crontab looks like:

crontab:

00 22 * * * cmd /c "winscp /console /script=c:\bin\scplogs /log=LOG_OF_SCP.LOG"

One could also compress the logs first to save some time, bandwidth, and space. Surely this is not the most elegant solution because the password is hardcoded into the scp script, but could be replaced with keys if you like.

share|improve this answer

You can also use psftp.exe to do the job with a command line like this one:

psftp.exe username@server -be -pw user_password -b c:\script.txt"  
Script.txt may contain for example:
lcd c:\my_backup
get /var/log/application/*
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.