RPM Log
*** This document is still a draft. Please feel free to add comments ***
Currently RPM doesn't keep it's own log of what happened. This has led to upper layer tools (yum, zypper) implementing their own logging facilities. This has the disadvantage that all operations done by other tools (including the rpm command line) are missing in these logs. Main problem for an implementation within rpm itself is that the set of information that needs to be stored differs between the upper level tools and pieces of information are not known to rpm itself (marked with (X) below). So there are new functions needed to attach this information to both the transaction and the transaction elements.
This feature is not intended to allow to continue or repair a broken transaction but only see what operations have been run in the past. So more fine grained information is intentionally left out. For recovering broken transactions another log might be added in the future.
Design
Format should be readable to both humans and machines. "Classic" log file in /var/log/rpm that can be rotated by log rotate (if neccessary). Format needs to be extendible with application specific "tags" but for most stuff there should be predefined names so tools can share information more easily.
Alternative would be per transaction files. Probably /var/log/rpm/TIMESTAMP(.N). Switching between those alternatives should be easy.
Lines
Start Transaction
- "STARTTRANSACTION"
- StartTime
- TransactionFlags
- RpmlibVersion
- RpmDbIdBefore "check" sum of rpmdb
Command Line
- "CommandLine?"
- ARGV - each parameter in one column ((X) may be overwritten by application)
Command
- "Command"
- (X) CommandName (human readable)
- (X) CommandVersion
- (X) Operation human readable name of the operation selected by the user (mainly for GUI applications, use CLI command name otherwise)
- (X) DepsolverFlags (optional) comma separated, named options - depend on upper layer tool like yum or zypper
- (X) User (optional) user requesting the operation (try passing real user name from GUI apps)
Repository
All (X)
- "Repository"
- Name - human readable name
- Id - to be used in the packages "Origin" tag
- Type - should include a version number
- Date - creation date
- Version - version number of the repository (really needed/available? somehow redundant with Date
- Location - URL the repo was downloaded from / path where it can be found on disk
Transaction Element
- "INSTALL" | "REMOVE"
- NEVRA
- CheckSum (SHA1:1234567890)
- RpmDbId
- (X) Reason for installing/removing the package (SELECTED by user, part of selected GROUP, BYDEPENDENCY, UPDATE, OBSOLETE)
- (X) Origin Repository name or location (path, URL) the package came from (installs only)
- (X) Groups the package is in or was installed as part of
- (X) link to aditional update, security information, reason for issuing this update (optional)
Related Packages
- "UPDATES"|"UPDATEDBY"|"OBSOLETES"|"OBSOLETEDBY"
- NEVRA of package (one per column? more information needed? Check sum, rpmid also needed? May be use a regular package block with some information left out (references to other blocks)?)
Files of a TE
Line belongs to the TE line above
- "Files"
- One file per column (rpmsave and rpmnew only)
Scriptlet output
Only for failed scriptlets - everything else should be 0 and ""
- "SCRIPTLET"
- ("PRE"|"POST")"UN"?"TRANS"
- NEVRA of package
- Exitcode
- Output
Trigger output
Only for failed scriptlets - everything else should be 0 and ""
- "TRIGGER"
- ("PRE"|"POST")"UN"?"TRANS"
- NEVRA of package
- TNEVRA of triggering package
- Exitcode
- Output
Messages
- "WARNING"|"ERROR"
- Message
End Transaction
- "ENDTRANSACTION"
- EndTime
- RpmDbIdAfter
Format
Dates in fixed order with "|" as separator one item (package/transaction) per line (similar to the libzypp Package History)
- Add comments to explain the rows from time to time to improve readability
- Needs a mechanism to deal with extentions and lists
- May be allow appending things in the following lines with leading tab and one item per line
- Or key:value pair at the end of the line
- makes the probably most interesting items less readable...
Sample (may be out of date):
STARTTRANSACTION Tue Feb 23 16:58:57 CET 2010|4.9.0|force|b1f5b4b255fe69efc90feec6793fb307 CommandLine yum|-y|--skip-broken|install|foobar Command Yum|3.2.25|Install|skipbroken|root # Repository name | version | URL Repository Fedora 17|base|md-V27|Tue Feb 20 16:58:57 CET 2010|2010028.0|http://foobar.com/fedora/28/x86_64 Repository Fedora 17 - updates|updates|md-V27|Tue Feb 20 16:58:57 CET 2010|2010028.0|http://foobar.com/fedora/28/x86_64 SKRIPT PRETRANS|foobar-99.3-22.noarch|bash: hgdhjsd: command not found\n # op NEVRA | checksum | dbId | reason | repo | groups | info INSTALL foobar-99.3-22.noarch|SHA1:1234567890|4527|updates|Selected|Humor,Administration| files /etc/foobar/default.conf.rpmnew|/etc/foobar/emergency.conf.rpmsave.2 OBSOLETES bar-43.2-2.noarch ENDTRANSACTION Tue Feb 23 17:58:57 CET 2010|77d3233bcc453c5800077a8ad4d3670c
Quoting
As we use lines and and "|" to structure the data we need to use quoting. "\" is used for quoting.
- newline - "\n"
- Null char - "\0" (can happen in script outputs and may course trouble)
- "\" - "\\"
- "|" - "\|"

