Log File UNIX Commands

| Total Words: 298

One of the biggest parts of my job is managing website log files. Our business is very marketing-centric, so missing log file data isnt expectable. There have been a few situations were log files have been split or broken. Below are three nice little commands which have helped tremendously.

Removes all log files with no data
find /home/httpd/logs -size 0 -type f -print0 xargs -0 rm f
This is a simple little command which helps keep things neat and organized. Once files rotate Ive found a bunch of empty files on the folder. This really confuses some of the marketing people.

Converts log files extention into logical month.
for i in `dir /home/httpd/logs/*-access_log.1sed s/.1$//`; do mv $i.1 $i.feb; done
A little more complicated. Again, the overall goal here is to make the log files more friendly for marketing people connecting into the FTP server. I am converting the *.1 extension file created by the log rotate into *.month. I use this single line to change the extension on 300+ files. Works fantastic!

Combines log files with extentions .1.1 -> .1 and creates a new...

To view and download this full PLR article, you must be logged in. Registration is completely free. Once you create your account, you will be able to browse, search & downlod from our PLR articles database of over "1,57,897+" on 1,000's of niches and 200+ categories without paying a penny. Click here to signup...

** PLR to VIDEO: Create Awesome Videos From PLR Articles... FAST!...