All logs of dpkg are saved at /var/log/dpkg . The thing is if you are on Debian testing or/and Unstable/Sid the churn of packages are going to be much more than in a stable release. Now while in a stable release the churn is not so much and 7-8 log files should be in a position to serve . But in testing this simply proves to be too little.

For instance at my own end -

┌─[shirish@debian] - [~] - [10114]
└─[$] zgrep " install " /var/log/dpkg.log.8.gz | tail -1

2016-05-31 12:26:29 install gnuplot-qt:amd64 <none> 4.6.6-3

Now while this is somewhat useful, if I want to go back till a year, all of that info. is lost.

How can I prevent it from happening in the future ?

It would be better if the change were only limited to dpkg logs rather than all the logs.

1 Answer 1


You edit the file /etc/logrotate.d/dpkg, there should be a section there similar to this :

/var/log/dpkg.log {
        rotate 12
        create 644 root root

You change the rotate 12 to rotate 24 to keep 2 years of logs, or rotate 36 to keep 3 years of logs.

  • there is also /var/log/alternatives.log just beneath /var/log/dpkg.log in /etc/logrotate.d/dpkg , any idea what that is used for ?
    – shirish
    Jan 5, 2017 at 0:22
  • That is when update-alternatives command is run, the one that handles the /etc/alternatives/ directory.
    – ojs
    Jan 5, 2017 at 0:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .