开发者

Automatically download log file from Unix server to Windows machine

I have a Unix server on which a continuously running application generates a large text log. (aprox. 100megs an hour).

My main development machine is a Windows computer and to see what's going on with the application I use Filezilla to download开发者_StackOverflow中文版 the log file to the PC where I use notepad++ to go thru log entries.

The whole process seems a bit convoluted to me - so could you recommend a tool that I could run on my PC to connect to the Unix box and automatically download the log file - so I could dissect it on my Windows machine where I have all the required tools (my Unix access is very restricted - so viewing a log file on the Unix box is not really an option).

Thank you.


Windows itself has these tools. Use ftp to get the file. You can set up a file called snatch.ftp:

user
USERNAME
PASSWORD
get /location/of/logfile.txt logfile.txt
bye

(with suitable values of USER and PASSWORD) then have a command file (snatch.cmd) run by scheduled tasks on whatever schedule you desire:

ftp -n -s:snatch.ftp

I have to say though that generating 100M an hour is not a very good idea for any log file. It may be that this is necessary but you should examine why so much data is being generated and whether it is really necessary.

Shifting 100M an hour across the network is also something I'd be circumspect of as well. I know you stated that you don't have a lot of access to the UNIX side but I'd still be looking at that as the first choice, especially since the text processing tools under UNIX are more than up to the task.

At a bare minimum, think about filtering the log file a little on the UNIX side before copying it to your own box. Your network administrators will be eternally grateful :-)


Can you use the Windows "scheduled jobs" feature to invoke your ftp client periodically?

Or, going the other way, can your Unix box push the file to a place that's easier for you to access, such as a shared drive?


you can create a batch file to ftp(file transfer) your log file to your PC. An example, imagine your unix server is 10.10.10.10, so you create a file called ftp.txt,

open 10.10.10.10
anonymous
test@somewhere.com
cd path
get file.log
quit 

then on the command line

c:\test> ftp -s:file.txt 
c:\test> notepad file.log

Alternative, since you have FileZilla, you may look at the documentation to see if there are any command line you can use instead of the windows ftp client.


Automate downloading the log file from UNIX system using ftp batch command.

FTP (file transfer protocol) is a file transfer utility commonly used with UNIX systems.

FTP is capable of using scripts (lists of commands from external files). The following example demonstrates a script that opens a connection to IP address 11.11.11.11, logs on to the host as a guest with the password "guest," uploads the File1 file, and then quits:

open 11.11.11.11
user
guest
guest
put file1
quit

http://support.microsoft.com/kb/96269


it looks like the easiest and most fault-proof way would be to get WGet for Windows and call it with the syntax of wget ftp://login:password@host/path/file from a batch file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜