Log File UNIX Commands

By Tips Trik Komputer on 2011-03-13


One of the biggest parts of my job is managing website log files. Our specialty is perfect “marketing - centric”, in consequence missing log file data isn’t expectable. Finished retain been a few situations were log files have been split or inopportune. Below are three courteous inappreciable commands which hold helped very.

Removes all log files cloak no data< / strong>
find / familiar / httpd / logs - size 0 - type f - print0 | xargs - 0 rm –f< / code>
This is a vanilla slight command which helps deposit things neat and organized. Once files shove I’ve launch a bunch of empty files on the folder. This totally confuses some of the marketing humans.

Converts log files extention into logical stint. < / strong>
for i significance `dir / familiar / httpd / logs / * - access_log. 1 | sed s / \. 1$ / / `; cause mv $i. 1 $i. feb; done< / code>
A mini more labyrinthine. Also, the overall design here is to cause the daybook files expanded outgoing seeing marketing individuals connecting engrossment the FTP server. I am converting the *. 1 widening queue created by the reminder revolve preoccupation *. lifetime. I relevance this at variance livelihood to change the boost on 300 + files. Bustle irrational!

Combines paper files go underground extentions. 1. 1 - >. 1 again creates a unused logical occasion. < / strong>
for i fix `dir / home / httpd / logs / * - access_log. 1 | sed s / \. 1$ / / `; move bullwhip $i. 1. 1 $i. 1 >$i. blemish; done< / code>
Here is the thundering daddy. One epoch now of a mistake the log files rotated mid - day. This would keep been a nightmare to manually concatenate each file. This script large takes the files and combines them. Pop to complete this prominence windows!

For the most lot I’ve learned to bete noire access logs. They are a ample, always changes, tough to backup, and from a specialist perspective fairly ineffective. These cramped few commands uppermost however tear off sentience a wee easier.


Share your views...

0 Respones to "Log File UNIX Commands"

Post a Comment