About Me

My photo
Working as Technical Lead in CollabNET software private limited.

Tuesday 26 February, 2008

To split and analyze the log files.

When ever the log file size is more, Try splitting it and view the file!

Calculate the length of the log file

wc -l log-file.log

Then split the file based on the total number of lines.
For ex Consider the no of lines as 1000, then we can split in to files of 100 lines using below command.

split -l100 log-file.log log-file.log.

This will result in multiple files of 100 lines each. The name of files would be appended by aa,ab,....

To rejoin the file use below command

$ cat log-file.log.* >lastweek.mp3

No comments: