Skip to Content

Sort your crashlogs with Hazel



I've been on a bit of a Hazel kick lately. I wrote a short shell script that will sort my Crash Logs.
#!/bin/sh 

### Get the name of the app 
APP=`/bin/echo $1 | /usr/bin/sed 's#_.*##g'` 

### make a directory 
/bin/mkdir -p "$APP" 

### move the log into the directory 
/bin/mv -n "$1" "$APP" 

### done! 
exit 0 

Add this rule to the folder ~/Library/Logs/DiagnosticReports. The rules above tell Hazel to only run on crash logs older than today, in case you need to do anything with it such as send it to the developer.

UPDATE: Note that the developer of Hazel left a comment below showing how to do this without a script.



I've been on a bit of a Hazel kick lately. I wrote a short shell script that will sort my Crash Logs. #!/bin/sh ### Get the name of...
 

Add a Comment

*0 / 3000 Character Maximum Comment Moderation Enabled. Your comment will appear after it is cleared by an editor.

6 Comments

Filter by:
Allan

What is this "crash" of which you speak?

May 24 2010 at 6:46 PM Report abuse rate up rate down Reply
NovaScotian

In Leopard, the link opens Hazel and asks for a folder to apply it to. Have the log folder added before you click the link here.

May 24 2010 at 2:34 PM Report abuse rate up rate down Reply
Paul Kim

Hi. I'm the author of Hazel and thought I'd chime in here.

You can actually do what you want without a script. If you set up a condition like "Name matches...", you can set up a pattern where you can capture the app name at the beginning of the file name. The crash logs start with the app name, followed by an underscore, followed by the date and machine. So, you can set up a pattern to grab everything up to the first underscore into what's called a custom token. You can then use "Sort into subfolders" and use the custom token you previously defined which should contain the app name.

I've posted an example rule you can download and load up into Hazel to see how it's done: http://www.noodlesoft.com/examples/sortlogsbyapp.hazelrules

There may be some changes needed to handle more oddball cases so this example should be used for more illustrative purposes. Tweak it as needed.

May 24 2010 at 11:09 AM Report abuse rate up rate down Reply
1 reply to Paul Kim's comment
Paul Kim

The above link may load the file into your browser. If that happens, go back and right-click on the link and save it to your disk. I'm working on fixing it on the server. Sorry about the invconvenience.

May 24 2010 at 11:13 AM Report abuse rate up rate down Reply
Level 5

Come on guys, we all know Macs don't crash ;)

May 24 2010 at 9:15 AM Report abuse rate up rate down Reply
1 reply to Level 5's comment
TJ Luoma


I realize you were making a joke, but it's worth noting that these are for *app* crashes, not operating system crashes.

May 24 2010 at 1:04 PM Report abuse rate up rate down Reply
Buy an ad here

Tweets

© 2012 AOL Inc. All Rights Reserved.