aspose file tools*
The moose likes Linux / UNIX and the fly likes Downloading log files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Downloading log files" Watch "Downloading log files" New topic
Author

Downloading log files

Mike Skit
Greenhorn

Joined: Feb 09, 2008
Posts: 23
Hi All,
I am new to Unix/Linux systems.
I need to write a program in java, does the following:-
1)Log in to Linux on which the server logs are,
2)Download the log files,
3)View in Excel if possible..

Please do give your best suggestions..

Appreciate your responses..

Thanks,
-Mike
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

How much control do you have on the Unix box?
If you can configure an FTP server with access and permissions to the log files, it's fairly easy to write a Java program to fetch them using Jakarta's commons/net libraries.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Mike Skit
Greenhorn

Joined: Feb 09, 2008
Posts: 23
Hi Ben,
Thanks for replying..

Do you mean something like below ... ? I did some googling after reading your comments...

FTPClient ftpClient = new FTPClient();
ftpClient.connect("ftp.foo.com", "user01", "pass1234");
ftpClient.download("C:\\Temp\\", "README.txt");
// Eventually other operations here ...
ftpClient.disconnect();

I am new to FTP also.. just wondering if the above was what you meant..
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

An FTP server is similar to a web server in that you have to set up a base directory and user permissions. Once you have that running on the server, then, yes, you should be able to use the Jakarta commons/net libraries to fetch your files.

I haven't looked at them in a while so I don't know if your code is right or not.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Originally posted by Mike Skit:
Hi All,
I am new to Unix/Linux systems.
I need to write a program in java, does the following:-
1)Log in to Linux on which the server logs are,
2)Download the log files,
3)View in Excel if possible..

0) Why does it have to be Java?

For scp (secure copy) you need to have ssh running on the Linux machine.
This gives you the ability to exchange keys, so you don't need to use the password every time.
I'm pretty sure you'll find a ssh/scp version for Windows.

Using Java for that task (ftp/scp, starting excel) doesn't seem very plausible to me.


http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Downloading log files