How can i send a message to a log file (not the apt log) after the installation of a package. I simple want to log which package (package name) was installed. ie. links installed successfully
send message to log file after package installed
ubuntu;apt;logs
/var/log/dpkg.log should contain the information you want:From man dpkg:--log=filenameLog  status  change  updates and actions to filename, instead of the default /var/log/dpkg.log. If this option is given  multiple times, the  last filename is used.Log messages are of the form:YYYY-MM-DD HH:MM:SS startup type command for each dpkg invocation  where  type  is  archives  (with  a  command  of unpack or install)  or  packages  (with  a  command  of  configure,  triggers-only,  remove  or purge);YYYY-MM-DD HH:MM:SS status state pkg installed-version for status  change  updates;YYYY-MM-DD HH:MM:SS  action pkg installed-version available-version for actions where action is  one  of  install,  upgrade,  configure, trigproc,  disappear,  remove or purge;and YYYY-MM-DD HH:MM:SS conffile filename decision for conffile changes where  decision is either install or keep.e.g. I installed ksh this morning to investigate a difference between mksh and ksh93.# grep ksh /var/log/dpkg.log2015-11-18 09:39:52 install ksh:amd64 <none> 93u+20120801-22015-11-18 09:39:52 status half-installed ksh:amd64 93u+20120801-22015-11-18 09:39:52 status half-installed ksh:amd64 93u+20120801-22015-11-18 09:39:52 status unpacked ksh:amd64 93u+20120801-22015-11-18 09:39:52 status unpacked ksh:amd64 93u+20120801-22015-11-18 09:39:57 configure ksh:amd64 93u+20120801-2 <none>2015-11-18 09:39:57 status unpacked ksh:amd64 93u+20120801-22015-11-18 09:39:57 status unpacked ksh:amd64 93u+20120801-22015-11-18 09:39:57 status half-configured ksh:amd64 93u+20120801-22015-11-18 09:39:57 status installed ksh:amd64 93u+20120801-2If you just want to know when packages have been installed or upgraded, try something like this:# zgrep -E '(install|upgrade) bash[: ]' /var/log/dpkg.log*/var/log/dpkg.log.12.gz:2014-11-25 12:19:59 upgrade bash:amd64 4.3-11 4.3-11+b1/var/log/dpkg.log.2.gz:2015-09-12 18:52:44 upgrade bash:amd64 4.3-13 4.3-14/var/log/dpkg.log.4.gz:2015-07-29 10:27:33 upgrade bash:amd64 4.3-12 4.3-13/var/log/dpkg.log.9.gz:2015-02-09 11:54:56 upgrade bash:amd64 4.3-11+b1 4.3-12The trailing [: ] in the regex is to exclude other packages such as bash-builtins, bash-completion, bash-doc etc from the listing.