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.
Share
Categories
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
What is this "crash" of which you speak?
May 24 2010 at 6:46 PM Report abuse Permalink rate up rate down ReplyIn 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 Permalink rate up rate down ReplyHi. 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.
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 Permalink rate up rate down ReplyCome on guys, we all know Macs don't crash ;)
May 24 2010 at 9:15 AM Report abuse Permalink rate up rate down Reply
I realize you were making a joke, but it's worth noting that these are for *app* crashes, not operating system crashes.
Deals of the Day
more deals- $15 Apple iTunes Gift Card for $8 for new Saveology customers
- Philips Fidelio Docking Speaker Station for iPhone / iPod for $38 + $6 s&h
- Retro 80's Case for iPhone for $11 + $2 s&h
- HHI 360 Dual-View Stand Case for new iPad w/ $2 credit for $12 + $3 s&h
- HHI ReElegant Smart Cover Companion Case for new iPad from $5 + $3 s&h
- Used Apple iPad 64GB WiFi + 3G for $240 + free shipping
6 Comments