Welcome to our website
To take full advantage of all features you need to login or register. Registration is completely free and takes only a few seconds.
How to Split a Linux Log File by Day or Month
Posted by Philipp Esselbach on: 08/21/2012 09:44 AM [ Print | 0 comment(s) ]
OCmodshop shows you how to split the Linux log files by day or month
If you’re like me, then you’ve probably set up your Linux server completely wrong! Seriously though, many people who host with Linux probably have some hosting company set their server up. Unless your admins took the extra care to automatically separate your log files by date, then you may have noticed one huge-ass log file in your web page’s directory… especially if it isn’t compressed.
In my case I had an 11.3GB log file sitting in my home directory, and I really needed to split it up into smaller files.
There’s a very easy way to do this with the Linux command line.
Before you can split the file up, you need to go to the path of the log file folder. Depending on how your Linux server is set up, it may be in /var/log/httpd/ or /home/<username>/.
If you actually look at one of the log files, you will see several bits of information. You will notice that the date and time is recorded with each action in this format: [29/Mar/2012:12:00:00 -0700]. Knowing how the date is stored will help you split the files up.
In my case I had an 11.3GB log file sitting in my home directory, and I really needed to split it up into smaller files.
There’s a very easy way to do this with the Linux command line.
Before you can split the file up, you need to go to the path of the log file folder. Depending on how your Linux server is set up, it may be in /var/log/httpd/ or /home/<username>/.
If you actually look at one of the log files, you will see several bits of information. You will notice that the date and time is recorded with each action in this format: [29/Mar/2012:12:00:00 -0700]. Knowing how the date is stored will help you split the files up.
How to Split a Linux Log File by Day or Month
Related Threads
11/12/2008 09:07 PM: how to setup network linux machine? (1) by danleff
01/22/2006 03:41 PM: need help how to set up replication on fedora core 4 (0) by lansme
03/30/2005 02:30 AM: know how to solve about monitor out of range? (4) by danleff
03/30/2005 01:28 AM: know how to solve about monitor out of range? (1) by LinuxCrusader
03/29/2004 04:26 AM: HOW TO SET UP PRINTING ON KNOPPIX (1) by jimf43
03/15/2004 07:41 PM: How to share internet connection between 2 PC's (1) by CorpoSemAlma
02/13/2004 10:32 PM: how to setup vc++ (3) by outstream
01/05/2004 07:59 PM: How to set up a linux network boot on RedHat 9.0 Linux (0) by rabbit-zek
08/27/2004 02:14 AM: How to share files with WinXP? (6) by trankillooo
07/22/2003 08:08 AM: how to setting up lan in mandrake 9.1? (2) by nightblade_
01/22/2006 03:41 PM: need help how to set up replication on fedora core 4 (0) by lansme
03/30/2005 02:30 AM: know how to solve about monitor out of range? (4) by danleff
03/30/2005 01:28 AM: know how to solve about monitor out of range? (1) by LinuxCrusader
03/29/2004 04:26 AM: HOW TO SET UP PRINTING ON KNOPPIX (1) by jimf43
03/15/2004 07:41 PM: How to share internet connection between 2 PC's (1) by CorpoSemAlma
02/13/2004 10:32 PM: how to setup vc++ (3) by outstream
01/05/2004 07:59 PM: How to set up a linux network boot on RedHat 9.0 Linux (0) by rabbit-zek
08/27/2004 02:14 AM: How to share files with WinXP? (6) by trankillooo
07/22/2003 08:08 AM: how to setting up lan in mandrake 9.1? (2) by nightblade_
