How to use the command rspamc (with examples)

How to use the command rspamc (with examples)

The rspamc command is a command-line client for rspamd servers. It allows users to interact with the server by performing various operations such as training the bayesian filter, generating manual reports, and retrieving server statistics. This article will provide examples of each of these use cases.

Use case 1: Train the bayesian filter to recognize an email as spam

Code:

rspamc learn_spam path/to/email_file

Motivation: This use case is helpful when you receive an email that has been incorrectly classified as ham (non-spam) by the bayesian filter and you want to train it to recognize similar emails as spam in the future.

Explanation: The rspamc learn_spam command is used to teach the bayesian filter to recognize an email as spam. The path/to/email_file argument specifies the path to the email file that you want to use for training.

Example Output:

Learned spam message from path/to/email_file 

Use case 2: Train the bayesian filter to recognize an email as ham

Code:

rspamc learn_ham path/to/email_file

Motivation: This use case is useful when you receive an email that has been incorrectly classified as spam by the bayesian filter and you want to train it to recognize similar emails as ham in the future.

Explanation: The rspamc learn_ham command is used to teach the bayesian filter to recognize an email as ham. The path/to/email_file argument specifies the path to the email file that you want to use for training.

Example Output:

Learned ham message from path/to/email_file 

Use case 3: Generate a manual report on an email

Code:

rspamc symbols path/to/email_file

Motivation: This use case is helpful when you want to get an in-depth analysis of a specific email to understand how it has been classified by the rspamd server.

Explanation: The rspamc symbols command is used to generate a manual report on an email. The path/to/email_file argument specifies the path to the email file for which you want to generate the report.

Example Output:

Symbols report for path/to/email_file:
  - SYMBOL1: 2.5
  - SYMBOL2: -0.5
  - SYMBOL3: -0.2
  ...

Use case 4: Show server statistics

Code:

rspamc stat

Motivation: This use case is useful when you want to retrieve statistics about the rspamd server, such as the number of processed messages, the number of spam messages, and the server uptime.

Explanation: The rspamc stat command is used to show server statistics. It does not require any additional arguments.

Example Output:

Processed messages: 1000
Spam messages: 200
Ham messages: 800
Uptime: 5 days 2 hours 30 minutes
...

Conclusion:

The rspamc command provides a command-line interface for interacting with rspamd servers. With its various use cases, users can train the bayesian filter, generate manual reports, and retrieve server statistics. By understanding how to use these commands effectively, users can better manage the spam classification system and gain insights into their email system’s performance.

Related Posts

How to use the command mkdir (with examples)

How to use the command mkdir (with examples)

The mkdir command is used to create directories in a filesystem.

Read More
How to use the command "virsh-pool-build" (with examples)

How to use the command "virsh-pool-build" (with examples)

Code: virsh pool-build --pool pool1 Motivation: This command is used to build the underlying storage system for a virtual machine storage pool.

Read More
Sequelize Command Examples (with examples)

Sequelize Command Examples (with examples)

Sequelize is a promise-based Node.js ORM (Object-Relational Mapping) that provides an easy way to interact with various relational databases such as Postgres, MySQL, MariaDB, SQLite, and Microsoft SQL Server.

Read More