Lacking dB entries in redis db for rspamd

766 views
Skip to first unread message

Sophie Loe

unread,
Apr 29, 2018, 4:47:17 PM4/29/18
to rspamd
Hi, 

After running rspamd for a few months,  I looked in the dB and see 45 keys.  Traffic is low ( 345 connections daily ). but I fed 15,000 emails (spam+ham) into Rspamd go to for classification to have something to work with. I expected to see something from those.  

Is 45 entries expected results?

# redis-cli dbsize
(integer) 45

# redis-cli keys "*"
rs_historymx10_zst
tRFANNE4A7A053DAC0BD36260_ham
tRFANN7AC21A9886AA6136260_spam
tRFANN2B73105D45484E6260_ham
rrbajjspkhzka8bhooqrc6
rrrqmgrpmrsfmei8jyxzfz
rrj8hnu5ibwwau6okmzey9
rrfxwic7inqicc5jt8uec7
rrfmbniczz61y6g3114p83
rrpu6zydawzyhw7qfrj8s1
tRFANNE4A7A053DAC0BD3626
tRFANN7AC21A9886AA6136260_ham
rrxpr5rxt4nqk4gg1bjikr
rrt791wokfm8zeqd47sm6m
tRFANN7AC21A9886AA613626
rrsfuc1se5t8jkcsmh9owo
rrqqzc99owseh8tueanfxq
learned_ids
ip_score
rr1oj8kuf6obzsf7bkw35n
tRFANNE4A7A053DAC0BD36260_spam
rr99w99kknde6fgqhn49bp
rr96cq65t6frqmwr8hp57e
tRFANN2B73105D45484E6260_spam
rrxpr5rxt4nqk4gg1bjikr
rrt791wokfm8zeqd47sm6m
tRFANN7AC21A9886AA613626
rrsfuc1se5t8jkcsmh9owo
rrqqzc99owseh8tueanfxq
learned_ids
ip_score
rr1oj8kuf6obzsf7bkw35n
tRFANNE4A7A053DAC0BD36260_spam
rr99w99kknde6fgqhn49bp
rr96cq65t6frqmwr8hp57e
tRFANN2B73105D45484E6260_spam
tRFANN2B73105D45484E626
rrc6yd8wbrexboyaaj4d1i
BAYES_SPAM
BAYES_HAM_keys
BAYES_SPAM_keys
rrj5yiqcoksbaqtg5jegf3
rs_history
BAYES_HAM


# cat local.d/redis.conf 
servers = "127.0.0.1";
disabled_modules = ["ratelimit","greylist"];

# cat local.d/statistic.conf
statistic.conf:    backend = "redis";

Rspamd  version 1.7.3-2~stretch

Kind regards, Sophie.

Sophie Loe

unread,
Apr 29, 2018, 4:57:46 PM4/29/18
to rspamd
P.S My redis know-how is lacking. 


--
You received this message because you are subscribed to a topic in the Google Groups "rspamd" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rspamd/v_k8Wcg4KGs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rspamd+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/rspamd.

Vsevolod Stakhov

unread,
Apr 29, 2018, 5:35:38 PM4/29/18
to Sophie Loe, rspamd
You are not using new schema for bayes and all tokens are stored in
'BAYES_HAM' and 'BAYES_SPAM' hash tables accordingly.

Sophie Lo

unread,
Apr 30, 2018, 1:28:57 AM4/30/18
to Vsevolod Stakhov, Sophie Loe, rspamd
Hi

Had no idea there was a new schema. I just upgrade when you release new packages.

Should I feed my spam/ham emails into rspamd again because of the new schema?
Best, Sophie
Sent from a mobile. Excuse my brevity.

Alexander Moisseev

unread,
Apr 30, 2018, 4:27:06 AM4/30/18
to rsp...@googlegroups.com
On 4/30/2018 8:28 AM, Sophie Lo wrote:
> Hi
>
> Had no idea there was a new schema. I just upgrade when you release new packages.
>
> Should I feed my spam/ham emails into rspamd again because of the new schema?
>

No, you can use `rspamadm configwizard statistic` command to convert statistic.

https://rspamd.com/announce/2018/03/12/rspamd-1.7.0.html
https://rspamd.com/doc/migration.html#migration-to-rspamd-170
https://rspamd.com/doc/modules/bayes_expiry.html

Sophie Loe

unread,
Apr 30, 2018, 12:04:55 PM4/30/18
to Alexander Moisseev, rsp...@googlegroups.com
Hi Alexander,

Thanks for the command.

# rspamadm configwizard statistic
cannot find dependency on symbol __BOUNCE_RPATH_NULL
cannot find dependency on symbol __MIME_VERSION
You are using an old schema for BAYES_HAM/BAYES_SPAM
Do you wish to convert data to the new schema?[Y/n]: y
Expire time for new tokens [default: 100d]: 200d
error converting symbol BAYES_SPAM: ERR invalid DB index
Conversion failed
No changes found, the wizard is finished now


So, I ran this without the statistics, and wonder if I may have a bad configuration that needs upgrading.


root@mx10 ~ # rspamadm configwizard
cannot find dependency on symbol __BOUNCE_RPATH_NULL
cannot find dependency on symbol __MIME_VERSION
____ _
| _ \ ___ _ __ __ _ _ __ ___ __| |
| |_) |/ __|| '_ \ / _` || '_ ` _ \ / _` |
| _ < \__ \| |_) || (_| || | | | | || (_| |
|_| \_\|___/| .__/ \__,_||_| |_| |_| \__,_|
|_|

Welcome to the configuration tool
We use /etc/rspamd/rspamd.conf configuration file, writing results to /etc/rspamd
Modules enabled: spamassassin, dkim_signing, mx_check, regexp, arc, maillist, metadata_exporter, multimap, surbl, dmarc, antivirus, whitelist, neural, trie, hfilter, phishing, emails, asn, settings, chartable, bayes_expiry, rspamd_update, ip_score, mid, url_redirector, rbl, once_received, milter_headers, fuzzy_check, history_redis, mime_types, forged_recipients, dkim, replies, force_actions, spf
Modules disabled (explicitly): spamtrap, url_tags, url_reputation
Modules disabled (unconfigured): reputation, dynamic_conf, fuzzy_collect, clickhouse, dcc, metric_exporter, elastic
Modules disabled (no Redis): ratelimit, greylist
Modules disabled (experimental):
Modules disabled (failed):
Do you wish to continue?[Y/n]:n


Is there a proscribed way to continue this migration?


Regards, S
> --
> You received this message because you are subscribed to the Google Groups "rspamd" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rspamd+un...@googlegroups.com.

Sophie Loe

unread,
May 4, 2018, 3:17:10 PM5/4/18
to rspamd
Hi,

Any ideas on how I can correct the configuration?

Alexander Moisseev

unread,
May 5, 2018, 4:54:33 AM5/5/18
to Sophie Loe, rsp...@googlegroups.com
On 4/30/2018 7:04 PM, Sophie Loe wrote:
> Hi Alexander,
>
> Thanks for the command.
>
> # rspamadm configwizard statistic
> cannot find dependency on symbol __BOUNCE_RPATH_NULL
> cannot find dependency on symbol __MIME_VERSION
> You are using an old schema for BAYES_HAM/BAYES_SPAM
> Do you wish to convert data to the new schema?[Y/n]: y
> Expire time for new tokens [default: 100d]: 200d
> error converting symbol BAYES_SPAM: ERR invalid DB index
> Conversion failed
> No changes found, the wizard is finished now
>

You can use `redis-cli monitor` to see what happens during conversion.

Sophie Loe

unread,
May 5, 2018, 2:29:15 PM5/5/18
to rspamd
Hi, Thanks for the command.

I ran these two command. I cannot make head nor tail of it.

# rspamadm configwizard statistic
cannot find dependency on symbol __BOUNCE_RPATH_NULL
cannot find dependency on symbol __MIME_VERSION
You are using an old schema for BAYES_HAM/BAYES_SPAM
Do you wish to convert data to the new schema?[Y/n]: y
Expire time for new tokens [100d]: 800d
error converting symbol BAYES_SPAM: ERR invalid DB index
Conversion failed
No changes found, the wizard is finished now


# redis-cli monitor
1525544702.498961 [0 127.0.0.1:54896] "SELECT" "rspamd_statistics"
1525544702.499002 [0 127.0.0.1:54896] "EVAL" "local ver = 0\n\nlocal tst = redis.call('GET', KEYS[1]..'_version')\nif tst then\n ver = tonumber(tst) or 0\nend\n\nreturn ver\n" "1" "BAYES_HAM"
1525544702.499401 [0 lua] "GET" "BAYES_HAM_version"
1525544702.500024 [0 127.0.0.1:54896] "EVAL" "local ver = 0\n\nlocal tst = redis.call('GET', KEYS[1]..'_version')\nif tst then\n ver = tonumber(tst) or 0\nend\n\nreturn ver\n" "1" "BAYES_SPAM"
1525544702.500069 [0 lua] "GET" "BAYES_SPAM_version"
1525544711.360435 [0 127.0.0.1:54898] "SELECT" "rspamd_statistics"
1525544711.360454 [0 127.0.0.1:54898] "SMEMBERS" "BAYES_HAM_keys"
1525544711.360908 [0 127.0.0.1:54898] "HLEN" "BAYES_HAM"
1525544711.360923 [0 127.0.0.1:54898] "HGET" "BAYES_HAM" "learns"
1525544712.732382 [0 127.0.0.1:54900] "SELECT" "rspamd_statistics"
1525544712.732412 [0 127.0.0.1:54900] "EVAL" "local keys = redis.call('SMEMBERS', KEYS[1]..'_keys')\nlocal nconverted = 0\n\nfor _,k in ipairs(keys) do\n local elts = redis.call('HGETALL', k)\n local neutral_prefix = string.gsub(k, KEYS[1], 'RS')\n local real_key\n\n for i,v in ipairs(elts) do\n\n if i % 2 ~= 0 then\n real_key = v\n else\n local nkey = string.format('%s_%s', neutral_prefix, real_key)\n redis.call('HSET', nkey, KEYS[2], v)\n if KEYS[3] and tonumber(KEYS[3]) > 0 then\n redis.call('EXPIRE', nkey, KEYS[3])\n end\n nconverted = nconverted + 1\n end\n end\nend\n\nreturn nconverted\n" "3" "BAYES_SPAM" "S" "69120000"
1525544712.732592 [0 lua] "SMEMBERS" "BAYES_SPAM_keys"
1525544712.732644 [0 lua] "HGETALL" "BAYES_SPAM"
1525544713.093568 [0 lua] "HSET" "RS_3543667526582040130" "S" "1"
1525544713.093609 [0 lua] "EXPIRE" "RS_3543667526582040130" "69120000"
1525544713.093629 [0 lua] "HSET" "RS_13512284961978803334" "S" "3"
1525544713.093647 [0 lua] "EXPIRE" "RS_13512284961978803334" "69120000"
1525544713.093663 [0 lua] "HSET" "RS_7487602517953670361" "S" "1"
…SNIP…
525544716.467563 [0 lua] "EXPIRE" "RS_14672978243770139711" "69120000"
1525544716.467577 [0 lua] "HSET" "RS_6604667819283224276" "S" "1"
1525544716.467591 [0 lua] "EXPIRE" "RS_6604667819283224276" "69120000"
1525544720.608941 [0 127.0.0.1:54902] "SELECT" "rspamd_statistics"
1525544721.672538 [0 127.0.0.1:54902] "SMEMBERS" "BAYES_HAM_keys"
1525544721.903388 [0 127.0.0.1:54902] "HLEN" "BAYES_HAM"
1525544721.903430 [0 127.0.0.1:54902] "HGET" "BAYES_HAM" "learns"
1525544724.247576 [0 127.0.0.1:54904] "SELECT" "rspamd_statistics"
1525544724.247596 [0 127.0.0.1:54904] "SMEMBERS" "BAYES_SPAM_keys"
1525544724.247790 [0 127.0.0.1:54904] "HLEN" "BAYES_SPAM"
1525544724.247800 [0 127.0.0.1:54904] "HGET" "BAYES_SPAM" "learns"
1525544725.979027 [0 127.0.0.1:54906] "SELECT" "rspamd_statistics"
1525544725.979051 [0 127.0.0.1:54906] "SMEMBERS" "BAYES_SPAM_keys"
1525544725.979600 [0 127.0.0.1:54906] "HLEN" "BAYES_SPAM"
1525544725.979613 [0 127.0.0.1:54906] "HGET" "BAYES_SPAM" "learns"



Any ideas?

Vsevolod Stakhov

unread,
May 5, 2018, 2:31:16 PM5/5/18
to Sophie Loe, rspamd
On 05.05.2018 19:29, Sophie Loe wrote:
> 1525544702.498961 [0 127.0.0.1:54896] "SELECT" "rspamd_statistics"

Please read Redis documentation: https://redis.io/commands/select

Your "db" option is clearly wrong.

Sophie Loe

unread,
May 5, 2018, 2:36:15 PM5/5/18
to rspamd
Thanks. Good to know.

I used this link to set up redis.
https://rspamd.com/doc/configuration/redis.html

Do the settings differ between 1.6 and 1.7? I’ve not used redis before and copy and pasted from your rspamd guides.
Sophie

Sophie Loe

unread,
May 5, 2018, 2:39:13 PM5/5/18
to rspamd
I read this on the site:

  • db: number of database to use (by default, Rspamd will use the default Redis database with number 0)

Isn’t my database using number 0 ?




On 5 May 2018, at 20:31, Vsevolod Stakhov <vsev...@highsecure.ru> wrote:

Sophie Loe

unread,
May 5, 2018, 2:40:29 PM5/5/18
to rspamd
Or does this setting in redis affect this?

# grep database redis.conf|grep -v ^#
databases 8

Alexander Moisseev

unread,
May 5, 2018, 5:14:22 PM5/5/18
to rsp...@googlegroups.com
On 5/5/2018 9:40 PM, Sophie Loe wrote:
> Or does this setting in redis affect this?
>
> # grep database redis.conf|grep -v ^#
> databases 8
>

No.

>
>> On 5 May 2018, at 20:39, Sophie Loe <1sophiel...@gmail.com <mailto:1sophiel...@gmail.com>> wrote:
>>
>> I read this on the site:
>>
>> * |db|: number of database to use (by default, Rspamd will use the default Redis database with number |0|)
>>
>>
>> Isn’t my database using number 0 ?
>>
>>>>  [0 127.0.0.1:54896]
>>

Yes.

>>
>>> On 5 May 2018, at 20:31, Vsevolod Stakhov <vsev...@highsecure.ru <mailto:vsev...@highsecure.ru>> wrote:
>>>
>>> On 05.05.2018 19:29, Sophie Loe wrote:
>>>> 1525544702.498961 [0 127.0.0.1:54896] "SELECT" "rspamd_statistics"
>>>
>>> Please read Redis documentation: https://redis.io/commands/select
>>>
>>> Your "db" option is clearly wrong.
>>

SELECT <dbid>
where dbid is a number between 0 and 'databases'-1

Logical databases have numeric indexes and "rspamd_statistics" is not a number.

Try
$ grep -nr 'db =' /etc/rspamd

Sophie Loe

unread,
May 6, 2018, 3:25:48 AM5/6/18
to rspamd
Hi,


# grep -nr 'db =' /etc/rspamd
/etc/rspamd/modules.d/redis.conf:22: #db = "0";
Should this be uncommented?

# ls -l /etc/rspamd/modules.d/redis.conf
-rw-r--r-- 1 root root 1141 Sep 17 2015 /etc/rspamd/modules.d/redis.conf
I installed the server in 2018.

Alexander Moisseev

unread,
May 6, 2018, 5:47:50 AM5/6/18
to rsp...@googlegroups.com
On 5/6/2018 10:25 AM, Sophie Loe wrote:
> Hi,
>
>
> # grep -nr 'db =' /etc/rspamd
> /etc/rspamd/modules.d/redis.conf:22: #db = "0";
> Should this be uncommented?
>

No, it is fine. It is the default db index.

Then try to find "rspamd_statistics" in the configuration.

Sophie Loe

unread,
May 6, 2018, 4:41:31 PM5/6/18
to rspamd
Hi,

Found:

local.d/statistic.conf: database = rspamd_statistics

I guess this should be something else?

Alexander Moisseev

unread,
May 7, 2018, 8:04:27 AM5/7/18
to rsp...@googlegroups.com
On 06.05.2018 23:41, Sophie Loe wrote:
> Hi,
>
> Found:
>
> local.d/statistic.conf: database = rspamd_statistics
>
> I guess this should be something else?
>

It could be a number, not a string.
Just remove that line since you are using database 0.

Sophie Loe

unread,
May 7, 2018, 2:17:41 PM5/7/18
to rspamd
Hi,

I commented the line and restarted rspamd.

Got this error, which is an improvement.

# rspamadm configwizard statistic
cannot find dependency on symbol __BOUNCE_RPATH_NULL
cannot find dependency on symbol __MIME_VERSION
You are using an old schema for BAYES_HAM/BAYES_SPAM
Do you wish to convert data to the new schema?[Y/n]: y
Expire time for new tokens [100d]: 800d
converted 131396 elements from symbol BAYES_SPAM
error converting symbol BAYES_HAM: ERR Error running script (call to f_6b10841ba3e1dc0b4d91f9d7e1f1e8efb4039625): @user_script:15: @user_script: 15: -OOM command not allowed when used memory > 'maxmemory'.
Conversion failed
No changes found, the wizard is finished now

I changed the reference to maxmemory in redis.conf to 72mb and reran and it worked.

# rspamadm configwizard statistic
cannot find dependency on symbol __BOUNCE_RPATH_NULL
cannot find dependency on symbol __MIME_VERSION
You are using an old schema for BAYES_HAM/BAYES_SPAM
Do you wish to convert data to the new schema?[Y/n]: y
Expire time for new tokens [100d]: 800d
converted 131396 elements from symbol BAYES_SPAM
converted 230081 elements from symbol BAYES_HAM
Conversion succeed
File: /etc/rspamd/local.d/classifier-bayes.conf, changes list:
new_schema => true
expire => 69120000

Apply changes?[Y/n]: y
Create file /etc/rspamd/local.d/classifier-bayes.conf
1 changes applied, the wizard is finished now
*** Please reload the Rspamd configuration ***
root@mx10 /var/log # /etc/init.d/rspamd restart


I think this looks good, doesn’t it?

Alexander Moisseev

unread,
May 7, 2018, 2:55:24 PM5/7/18
to rsp...@googlegroups.com
Yes, it does, except "cannot find dependency on symbol" warnings.

Sophie Lo

unread,
May 7, 2018, 3:00:59 PM5/7/18
to rsp...@googlegroups.com
Any ideas on how could I start to investigate this?

> cannot find dependency on symbol ...



-- 
You received this message because you are subscribed to the Google Groups "rspamd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspamd+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/rspamd.

Alexander Moisseev

unread,
May 7, 2018, 3:06:56 PM5/7/18
to rsp...@googlegroups.com
On 5/7/2018 10:00 PM, Sophie Lo wrote:
> Any ideas on how could I start to investigate this?
>
> > cannot find dependency on symbol ...
>
Probably something is wrong with your configuration. Please run `rspamadm configtest` check your configuration files and `rspamadm configdump` output.

Sophie Loe

unread,
May 7, 2018, 6:23:53 PM5/7/18
to rspamd
Hi,

Had a look and cannot see what is wrong, other than the dependency on symbol/no corresponding rule complaints. The RBL_SPAMHAUS references are not present in the /etc/rspamd/spamassassin/local.cf nor /etc/rspamd/local.d/*


# rspamadm configtest
cannot find dependency on symbol __BOUNCE_RPATH_NULL
cannot find dependency on symbol __MIME_VERSION
symbol 'RBL_SPAMHAUS_DROP' has its score defined but there is no corresponding rule registered
symbol 'RBL_SPAMHAUS_PBL' has its score defined but there is no corresponding rule registered
symbol 'RBL_SPAMHAUS_SBL' has its score defined but there is no corresponding rule registered
symbol 'RBL_SPAMHAUS' has its score defined but there is no corresponding rule registered
symbol 'RBL_SPAMHAUS_XBL' has its score defined but there is no corresponding rule registered
symbol 'RBL_SPAMHAUS_CSS' has its score defined but there is no corresponding rule registered
syntax OK


It’s 2303 lines. I’ve put it on https://pastebin.com/d0DXh59j
# rspamadm configdump | wc -l
cannot find dependency on symbol __BOUNCE_RPATH_NULL
cannot find dependency on symbol __MIME_VERSION
2303

Alexander Moisseev

unread,
May 8, 2018, 1:40:43 AM5/8/18
to rsp...@googlegroups.com
On 5/8/2018 1:23 AM, Sophie Loe wrote:
> Hi,
>
> Had a look and cannot see what is wrong, other than the dependency on symbol/no corresponding rule complaints. The RBL_SPAMHAUS references are not present in the/etc/rspamd/spamassassin/local.cf nor /etc/rspamd/local.d/*
>
>
> # rspamadm configtest
> cannot find dependency on symbol __BOUNCE_RPATH_NULL
> cannot find dependency on symbol __MIME_VERSION
> symbol 'RBL_SPAMHAUS_DROP' has its score defined but there is no corresponding rule registered
> symbol 'RBL_SPAMHAUS_PBL' has its score defined but there is no corresponding rule registered
> symbol 'RBL_SPAMHAUS_SBL' has its score defined but there is no corresponding rule registered
> symbol 'RBL_SPAMHAUS' has its score defined but there is no corresponding rule registered
> symbol 'RBL_SPAMHAUS_XBL' has its score defined but there is no corresponding rule registered
> symbol 'RBL_SPAMHAUS_CSS' has its score defined but there is no corresponding rule registered
> syntax OK
>
>
> It’s 2303 lines. I’ve put it onhttps://pastebin.com/d0DXh59j
> # rspamadm configdump | wc -l
> cannot find dependency on symbol __BOUNCE_RPATH_NULL
> cannot find dependency on symbol __MIME_VERSION
> 2303

The most likely cause is a syntax error in a configuration file. Probably you are missing a curly bracket somewhere.

Sophie Loe

unread,
May 13, 2018, 3:15:59 PM5/13/18
to rspamd
Hi,

I found that one of my spamassassin rules had references to headers defined in 20_head_tests.cf and 20_vbounce.cf. I copied the ones I used into my local.cf loaded via Rspamd.

Mystery no longer a mystery.

Thanks.
Reply all
Reply to author
Forward
0 new messages