[SOLVED] How can I learn understand log files in OS X, any books/articles good for this?

Status
Not open for further replies.
Solution

  • Step 1: I suggest you begin by familiarizing yourself with Bash, Grep, Perl, sed, and AWK. You'll also want to understand the power of regular expressions.

    Step 2: Pick and choose between Bash, Grep, Perl, sed, and AWK. To start, you'll probably want to go with Bash and Perl. If you decide to go with Perl, "Beginning Perl" is a great book that's completely free and widely circulated (see link provided below). "Modern Perl: 2014 Edition", is yet another great book which, likewise, is completely free and widely circulated (see link provided below). When it comes to Bash, "Bash Guide for Beginners" is a wonderful tutorial for getting your toes wet (again, see link provided below).

    Step 3: Really learn regular expressions!...

itmoba

Reputable
Aug 14, 2015
768
0
5,360

  • Step 1: I suggest you begin by familiarizing yourself with Bash, Grep, Perl, sed, and AWK. You'll also want to understand the power of regular expressions.

    Step 2: Pick and choose between Bash, Grep, Perl, sed, and AWK. To start, you'll probably want to go with Bash and Perl. If you decide to go with Perl, "Beginning Perl" is a great book that's completely free and widely circulated (see link provided below). "Modern Perl: 2014 Edition", is yet another great book which, likewise, is completely free and widely circulated (see link provided below). When it comes to Bash, "Bash Guide for Beginners" is a wonderful tutorial for getting your toes wet (again, see link provided below).

    Step 3: Really learn regular expressions! "Regular Expressions, The Complete Tutorial" is another free book/tutorial. While the book is in print, it can also be downloaded. The author typically asks for a €5 donation, but the donation isn't compulsory (see link provided below).

    Step 4: If you want to know the internals of OS X without spending money, then, I suggest visiting the Mac Developer Library. It's literally a treasure-trove of information. Need I mention again that it's free!?

Links
Beginning Perl: https://www.perl.org/books/beginning-perl/
Modern Perl: 2014 Edition: http://www.modernperlbooks.com/mt/index.html
Bash Guide for Beginners: http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html
Regular Expressions, The Complete Tutorial: http://www.princeton.edu/~mlovett/reference/Regular-Expressions.pdf
Mac Developer Library: https://developer.apple.com/library/mac/navigation/
 
Solution

itmoba

Reputable
Aug 14, 2015
768
0
5,360
I can't recommend that because I'm not familiar with the book you cite. I've not read "Mac OS X and iOS Internals: To the Apple's Core", but from what I've heard it seems to be pretty easy to digest for people new to the scene (it's possible I did read it and then forgot I read it, though). That aside, there is one very worthy mention: "Mac OS X Internals: A Systems Approach". Unfortunately, I'm certain that the OP wouldn't understand much of the material without knowing C and having a CLI background in Linux, Unix, and/or Unix-variants.
 

JustSomeJoe

Distinguished
Oct 8, 2008
489
0
19,060
Why should anyone need to learn expression parsing just to read a log file?
All you need to do is open Console (from utilities) and read, if there's something you don't understand or want to know more about, simply cut and paste it into Google.
 

itmoba

Reputable
Aug 14, 2015
768
0
5,360
You do realize that logs can grow to proportions that make Bigfoot look like a grain of sand, right? Understanding regular expressions gives one a base point from which they can begin to comprehend base signatures. Let's use Perl for the moment to illustrate this simply.

Perl:
$logline = "Uh, oh! Some error occured. The error code number is 10545."; # this is the string in the log file, it's merely in the code to show it works if you want to try it out.

print $logline . "\n" unless (($logline =~ m/(error)/) && ($logline =~ 10548)); # this is a simple one-liner

So, what's happening here? The error-line is printed because the number "10548" doesn't match the expected "10545". A simple script that takes 10 seconds to write will allow you to go through a 10 MB log file with ease. We can modify this so that it looks for a range of numbers, likewise. The point, however, is that these tools are necessary to get a better understanding of what's going on under the hood of OS X (or any OS for that matter).
 

Rodion15

Distinguished
Sep 11, 2011
764
7
19,015


Many thanks!, I'm looking that.
 
Status
Not open for further replies.