Installing Logstash on Centos 7 for PowerMTA sync bounce/FBL processing

This article explains steps required to install and run Logstash to fetch sync sync-bounce and FBL account file entries to Oempro for bounce and FBL processing.

This article is written for CentOS 7 Linux distribution.

First, install Java if you don’t have it on your server. To see if you have Java installed on your server, runt this command:

java -version

You should see a result such as;

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

If you don’t see this output, you can install Java using this command:

yum install java-1.8.0-openjdk.x86_64

Import Elastic Repo GPG signing key:

rpm --import

Create Elastic 7 Repo:

cat > /etc/yum.repos.d/elastic-7.x.repo << EOF
name=Elasticsearch repository for 7.x packages

Install Logstash:

yum install logstash

Test Logstash:

cd /usr/share/logstash/bin/
./logstash -e 'input { stdin { } } output { stdout {} }'

You should see a message after a while, such as Pipeline main started

Once you see this message, type any string such as Hello World! and press ENTER.

In response, Logstash should display the output, something such as;

    "@timestamp" => 2020-11-10T03:48:47.392Z,
       "message" => "Hello World!",
      "@version" => "1",
          "host" => "centos7"

If you see this output, the installation is completed.

Stop Logstash by pressing Ctrl+C.

Once the installation is done, it’s time to configure your Logstash for Oempro.

Create the pipeline config file:

cd /etc/logstash/conf.d
vi oempro.conf

Copy the pipeline configuration file contents from your Oempro Admin Area > Bounce Processing > Integration tab.

Paste it to the oempro.conf file you have just edited.

Save and exit the file.

Now it’s time to edit your PowerMTA configuration and add two new accounting file directives. PowerMTA configuration file(s) can be found under /etc/pmta directory.

Edit your PowerMTA configuration file and set two acct-file directives you can find under Oempro Admin Area > Bounce Processing > Integration tab.

At the bottom of the page, you should see a PowerMTA configuration such as;

<acct-file /var/log/pmta/bounces.csv>
        move-interval 1h
        move-to /var/log/pmta/accounting/bounces/
        records b, rb
        record-fields b timeQueued,timeLogged,orig,rcpt,bounceCat,dsnStatus,dsnAction,dsnDiag,dsnMta,jobId,vmta,header_X-FBLId
        record-fields rb timeLogged,orig,rcpt,bounceCat,dsnStatus,dsnAction,dsnDiag,dsnMta,header_X-FBLId
        world-readable yes

<acct-file /var/log/pmta/fbl.csv>
        move-interval 24h
        move-to /var/log/pmta/accounting/fbl/
        records feedback-loop
        record-fields f timeLogged,format,header_To,header_Return-Path,reportedDomain,header_X-FBLId
        world-readable yes

Reload PowerMTA to apply the new configuration:

pmta reload

For debugging Logstash, you can run this command:

logstash /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/oempro.conf --path.settings /etc/logstash/

You can now start and enable Logstash to run on system boot:

systemctl start logstash
systemctl enable logstash

Important: On CentOS 7, if you try to start Logstash and get the error, Unit logstash.service could not be found, run the command below to generate systemd unit file:

/usr/share/logstash/bin/system-install /etc/logstash/startup.options systemd
  • The article was helpful
  • The article was not helpful

0 voters