• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

Move files from Redhat box to windows box

Here is the situation, I have a RedHat Linux firewall  with squid proxy and I need to get the squid log files out of the Linux box and in to a windows box so I can run some report tools against the raw data.

First, how do I get the files out of the Linux Box?
Second how do I automatically rename the log file on a daily basis to some date based name?
I figure there may be a script already capable of doing this.  Just take in to consideration that I am basically Linux illiterate, seriously!
0
stylmark
Asked:
stylmark
  • 3
  • 2
  • 2
  • +2
1 Solution
 
LuxanaCommented:
0
 
LuxanaCommented:
depends on what you going to copy hare is small script which will rename foobar file :
#/bin/bash
cp foobar foobar-$(date +%Y-%m-%d)


just apply this to your log files. Immy case I copy files with cp command if you want rename use rn command. Then run this command with cron
0
 
theruckCommented:
if you want to inspect squid log files you can use the software called "calamaris" which is a package of scripts creating html reports. i have some experience with that so if that is what you need, just tell me so i can point you to the right directions how to setup it.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
marxyCommented:
There is excelent and simple program
http://the.earth.li/~sgtatham/putty/latest/x86/pscp.exe

Just download it and save somewhere.

Use it as:
pscp.exe  user@linuxbox:/var/log/squid/access.log   .

To download all access files:
pscp.exe  -r user@linuxbox:/var/log/squid/access*   .

Where are:
   user - is your user of linux who can access /var/log/squid
   linuxbox - is the name or ip of your linux box
0
 
AlexeyZilberCommented:
There is a better way to rotate and manage your log files if you're running a redhat system.
Your system comes with logrotate; if it doesn't install the logrotate rpm.  The squid information is already in there:

 more /etc/logrotate.d/squid
/var/log/squid/access.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
}
/var/log/squid/cache.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
}

/var/log/squid/store.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
# This script asks squid to rotate its logs on its own.
# Restarting squid is a long process and it is not worth
# doing it just to rotate logs
    postrotate
      /usr/sbin/squid -k rotate
    endscript
}

For downloading the files, as mentioned above, winscp is the nicest program.  You can also setup a samba share but you probably don't want to run samba on your firewall.

If you run ssh use winscp, and make sure the ip of your accessing client is either in the firewall rules or in /etc/hosts.allow
0
 
AlexeyZilberCommented:
Additionally, if you choose to move the files manually via the cron, you must issue /usr/sbin/squid -k rotate after you rotate the logs (as seen above).  Otherwise squid wont continue logging if you remove the log file.
0
 
mburdickCommented:
I, too, recommend the use of logrotate to auto-create a new file every day.

However, AlexeyZilber's configuation information will possibly cause you some headaches. Don't use the "compress" option on the files unless you plan to uncompress them later as part of the reporting. And, you can use the Samba Server components on the Linux machine, create a share point, and auto-copy the "old" log file into the shared area after rotating by using a script in the "postrotate" section.
0
 
mburdickCommented:
Oh yeah.. the Samba share would potentially open the files up to your Windows machine to access them without having to script a copy across the network.
0
 
AlexeyZilberCommented:
That's true.  The logrotate.conf I posted is the stock one used by RedHat.  They are compressed with gzip, which can be opened by winrar (www.rarsoft.com) if you do wish to use them compressed.  Otherwise, take out the compress option.
It all depends on how much traffic you get.

If you do intend to run Samba on a firewall box, be careful with the secrurity.  Make sure the samba ports arent open on the outgoing interface, and also add your ip address to hosts-allow in the samba.conf file to restrict access.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now