Appearance
Making data human-readable
General overview:
- For indexes, index bundles, and fts indexes: Use
doveadm dump. - Scality object ID: Use the
scality-keys(1)script from the obox package. - Filenames: See the next section for how to dump timestamps in index bundles, fts and mail filenames.
Timestamps in filenames
This is especially useful when trying to figure out if some object was created recently or not. For example with the Obox Troubleshooting: Object exists in dict, but not in storage errors whether the object was created before or after upgrading to a version that fixed it. (Although that's not perfect either, because already orphaned objects can be copied.)
See script fname-parse(1) in the obox package.
UNIX Timestamps
Many places in Dovecot store UNIX timestamps. These can be converted to human-readable timestamps with for example:
sh
#!/bin/sh
# unix2date.sh
date -d "1970-01-01 UTC $1 seconds"To get the timestamps in another timezone, use e.g.: TZ=Japan unix2date.sh 1503848486
Timestamps in GUIDs
Dovecot stores a timestamp as part of the GUIDs it generates. For example OIDs, mail GUIDs, folder GUIDs, etc. As a special case, dsync+imapc uses truncated SHA1 of the folder name as the GUID for the migrated folders, because IMAP protocol doesn't support the concept of GUIDs. If a folder GUID timestamp appears to be impossible, it's most likely because it's not a real GUID but a migrated folder.
sh
#!/bin/bash
# guid2date.sh
guid=$1
hex=`printf $guid|cut -c 9-16|sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/'`
dec=`printf "%d" 0x$hex`
time=`date -d "1970-01-01 UTC $dec seconds"`
printf "$guid\nhex: $hex\ndec: $dec\ntime: $time\n"Migrated folder GUIDs
If a folder GUID doesn't seem to have a proper timestamp (as explained above), it most likely was created by dsync+imapc migration. That creates GUIDs based on the truncated 128bit SHA1 hash of folder names. So multiple users can be sharing these same "GUID"s. It's possible to verify whether a folder name results in such a GUID with:
sh
echo -n "Folder name" | sha1sum | cut -c 9-Remember not to include the linefeed when calculating the hash (use echo -n or printf).
For example:
- INBOX: c92f64f79f0d1ed01e6d5b314f04886c
- Sent: bfb2e03fdce327671e82bf173b1ccb8b
- Sent Messages: 821ad6df633fb0d4e5cfa2c2dadecc41
- Trash: 7f5af7ba291b2df1a11d573bdb55d7e9
- Drafts: e0187b65e763143666d22094cedfe6a4
- Spam: 59c97b78ad43f83b1f91e47936e7e7d1
- Junk: 87680557f26fcb26843f739f7427e8c4
- Notes: a3dc2e079f23ee1c57dfa76669b732aa