spamd Syslog Format

SpamAssassin 2.x Format

The traditional spamd syslog format looks like this:

Aug 15 06:47:37 dogma spamd[22796]: identified spam (21.6/5.0) for jm:1012 in 3.1 seconds, 1098 bytes.

This details the time, hostname, process ID in normal syslog format; then whether the message was spam or nonspam; the points and threshold used; the username and uid; the time taken to scan the message; and the size of message in bytes. This is what a ham line looks like:

Aug 15 07:17:57 dogma spamd[7666]: clean message (-1.1/5.0) for jm:1007 in 0.4 seconds, 1800 bytes. 

SpamAssassin 3.0.0 Format

As of SpamAssassin 3.0.0, spamd also produces syslog lines for each scanned message that are designed to be machine-parseable and extensible. It looks like this:

Aug 15 06:47:37 dogma spamd[22796]: result: Y 21 - BAYES_99,BODY_ENHANCEMENT2,DC

(in this example, I've broken it into multiple lines by inserting newlines, but in syslog, it's all one long line.)

Again, the normal syslog data (time, hostname, process ID) is present. In addition, the line contains "result: ", followed by what is basically the same format used by the MassCheck tool. This means: "Y" for spam or "." for nonspam; the points, rounded to an int; a skipped field ("-"); the list of tests hit, comma-separated; then a comma-separated list of name=value pairs.

The name=value pairs may appear in any order, and new ones may be introduced without warning; but they'll always be comma-separated. They include the following items:

  • scantime: the time in seconds taken to scan this message.
  • size: the size in bytes of the message.
  • mid: the Message-ID.
  • bayes: the score output by the Bayes classifier (NOTE: this could be in scientific notation, e.g. '2.22044604925031e-16', or as a normal number: '0.00437882812836221', or even '1').
  • autolearn: whether the message was autolearned or not (ham, spam, no, failed, disabled, unavailable).

Here's another example, this time from a ham mail:

Aug 16 05:40:53 dogma spamd[27160]: result: . -2 - BAYES_00,SPF_HELO_PASS,
SPF_PASS scantime=3.6,size=3959,mid=<
  • No labels