Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to know when we last ran the package upgrades/updates on our Debian server.

share|improve this question
add comment

3 Answers

The file /var/log/apt/history.log gives you information on when APT was run and what was done.

tail -3 /var/log/apt/history.log

will give you this information for the last run of APT (not necessarily the last run of upgrage, though).

To find out when was the last time you've run an upgrade, you want to look for a line starting with Upgrade: and then lookup up the timestamp in the following line of the file (which starts with End-Date:). The last such match is the last time you've run an upgrade.

share|improve this answer
1  
Well, actually, it does show the commands that were run, including upgrades. However, if the event is a while back, you might have to look at the compressed log files, in which case tail won't work. You would have to unzip the files first. –  wolfgangsz Jun 6 '11 at 16:23
    
@wolfgangsz You're right. By what I can see in my system, these files are rotated monthly. So, if your last upgrade was more than a month ago (or if you are in the beginning of a month) you might have to look in the previous files. –  goedson Jun 6 '11 at 21:39
    
The immediate following line isn't always End-Date: - sometimes it is Remove:. So slightly more complicated to write a script. –  Hamish Downer May 18 '12 at 13:15
    
I've written a nagios plugin based on this idea - github.com/aptivate/check_apt_last_update –  Hamish Downer Jun 5 '12 at 12:31
add comment

There are some other comments that are not bad, but what you are really looking for is /var/log/dpkg.log.

dpkg is a low level tool for manipulating packages thus every package modification will be logged there.

share|improve this answer
1  
And, being low level, you can't know if the actions logged by it are the result of an apt-get install xxx or apt-get upgrade or even an dpkg -i xxx.deb. For finding out when you ran package upgrades, it's better to look into APT's logs. –  goedson Jun 6 '11 at 21:35
add comment

Outside of lucking out on log files located in /var/log/apt - e.g.: /var/log/apt/var/log/history.log or /var/log/term.log

The closest thing I can think about is to examine dpkg:

ls -alt /var/lib/dpkg/info | head -n 10

The dates on the top should approximate the last time apt handled those packages.

share|improve this answer
    
which log files should I look at (if there are any)? –  omouse Jun 6 '11 at 15:22
    
If you have an abundance of compressed history.x.gz logs you can traverse them using (I wouldn't suggest zcat'ting a large collection of active logs, but this should be fine for these ones) zcat history.log.* |head -n 10 –  thinice Jun 6 '11 at 17:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.