Checking the log file for updates

User avatar
radioz
Posts: 406
Joined: Tue Nov 24, 2009 1:07 pm

Checking the log file for updates

Postby radioz » Mon Nov 08, 2010 10:01 pm

I like to periodically check the hda-updates log (among other things) to see what has been modified on my system and when it changed. My HDA has been running for almost a year, so the logfile is getting very large (over 20 MB so far!; hey devs - how about using logrotate?)

I hate wading through the huge file looking at which files have been modified, so I decided to write a little script to extract just the updates/additions for me. I thought that this might be useful for others, so I would like to share it with you:

Code: Select all

#!/usr/bin/python # # Dump update information from /var/log/hda-updates.log #!/usr/bin/python # # Display the date and files that were modified/installed. # # Reads the hda-updates log file and parses out just the file updates/additions. # It helps to see what has been modified and when. # # radioz # 11/8/2010 # log = '/var/log/hda-updates.log' f = open(log, 'r') lines = f.readlines() f.close() gotUpdates = False firstUpdate = False dateInfo = '' for ll in lines : l = ll.strip() # Ignore dependency heading if l == 'Installing for dependencies:' : continue if l == '' : # A blank line terminates the updates for a particular date if gotUpdates : # Display a blank line between dates print gotUpdates = False continue if gotUpdates : if firstUpdate : # Display the date above the first update print '%s:' % dateInfo firstUpdate = False # Reformat the file info slightly updateInfo = l.split() print ' %-16s %-6s %-20s %-16s %-5s %s' % (tuple(updateInfo)) if 'hda update attempt' in l : # This header appears once per hour in the log. Very few represent real updates. # Save the date information in case this is a real update. dateInfo = ' '.join(l.split()[5:]) if 'Updating:' in l : # This is a real update, set up the flags gotUpdates = True firstUpdate = True
Save this file to a convenient place on your hda (I used ~/bin/hda-updates) and make it executable.

Then just type hda-updates and it will print out all of the Amahi file updates.

This is an example of its output:

Code: Select all

Tue Aug 31 05:01:23 PDT 2010: hda-platform noarch 5.5-1 amahi 1.1 M hdactl i386 3.5-1 amahi 218 k wol i686 0.7.1-4.fc12 fedora 38 k Sat Sep 4 15:02:32 PDT 2010: hdactl i386 3.5.1-1 amahi 218 k Sat Oct 30 22:02:14 PDT 2010: hda-greyhole i386 0.6.28-1 amahi 47 k hda-platform noarch 5.6-1 amahi 1.0 M hdactl i386 3.6-1 amahi 218 k Sun Nov 7 20:01:29 PST 2010: hda-platform noarch 5.6-8 amahi 1.0 M
Let me know if you have any questions.

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Checking the log file for updates

Postby bigfoot65 » Tue Nov 09, 2010 6:07 am

That is awesome. Can you please add it to the wiki? We want to try and capture as much as we can there to make it easy for users to find.

Let us know once complete, if you can do it :) We can then add a link to the main page for User Tips and add a link to it.

Thanks so much for sharing.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

User avatar
radioz
Posts: 406
Joined: Tue Nov 24, 2009 1:07 pm

Re: Checking the log file for updates

Postby radioz » Tue Nov 09, 2010 12:29 pm

Sure!

I'll post back when I've added it.

User avatar
radioz
Posts: 406
Joined: Tue Nov 24, 2009 1:07 pm

Re: Checking the log file for updates

Postby radioz » Tue Nov 09, 2010 1:12 pm

Ok, I added it to the wiki.

http://wiki.amahi.org/index.php/Install ... leshooting

That seemed like the logical place for it.

User avatar
rgmhtt
Posts: 421
Joined: Sun Jan 11, 2009 9:26 am

Re: Checking the log file for updates

Postby rgmhtt » Mon Nov 22, 2010 7:26 am

What would be REALLY nice is a daily cron job that emailed only the last update and avoid a running commentary.

But for now this is nice.

User avatar
radioz
Posts: 406
Joined: Tue Nov 24, 2009 1:07 pm

Re: Checking the log file for updates

Postby radioz » Mon Nov 22, 2010 7:49 am

Great idea!
When I get some time, I'll take a look at it.

User avatar
rgmhtt
Posts: 421
Joined: Sun Jan 11, 2009 9:26 am

Re: Checking the log file for updates

Postby rgmhtt » Tue Nov 23, 2010 7:57 am

Consider adding this to logwatch, I just updated the instructions for installing logwatch:

http://wiki.amahi.org/index.php/Monitor ... via_E-mail

This refers to: http://www.logwatch.org/tabs/docs/HOWTO ... atch.html/ for customizing logwatch. This should make it easier and not give admins yet one more email to read.

Who is online

Users browsing this forum: No registered users and 48 guests