• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Downloading log files

 
Mike Skit
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mike Skit
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic