diff --git a/src/content/docs/infrastructure/host-integrations/host-integrations-list/postfix-monitoring-integration.mdx b/src/content/docs/infrastructure/host-integrations/host-integrations-list/postfix-monitoring-integration.mdx index 0831be36ecc..0ada3c21831 100644 --- a/src/content/docs/infrastructure/host-integrations/host-integrations-list/postfix-monitoring-integration.mdx +++ b/src/content/docs/infrastructure/host-integrations/host-integrations-list/postfix-monitoring-integration.mdx @@ -4,13 +4,12 @@ tags: - Postfix integration - New Relic integrations metaDescription: Use New Relics infrastructure agent to get a dashboard with metrics from your Postfix application. -freshnessValidatedDate: 2023-06-28 +freshnessValidatedDate: 2024-03-25 --- import infrastructurePostfixDashboard from 'images/infrastructure_screenshot-full_Postfix-dashboard.webp' - -Our Postfix integration helps you construct a complete picture of your mail server's performance. Our Postfix integration makes use of our infrastructure monitoring agent, and gives you a pre-built dashboard with your most important Postfix metrics like email delivery process, mail queue, and message overview. +Our Postfix integration consolidates mail server data into one view, so you can track how many emails are sent, bounced, or deferred in a given time period. Our Postfix integration uses our infrastructure monitoring agent, and gives you a pre-built dashboard with your most important Postfix metrics like email delivery process, mail queue, and message overview. -## Install the infrastructure agent [#infra] - -To get data into New Relic, install our infrastructure agent. Our infrastructure agent collects and ingests data so you can keep track of your mail server's performance. The version should be 1.10.7 or higher to support NRI-Flex integration. - -You can install the infrastructure agent two different ways: - -* Our [guided install](https://one.newrelic.com/nr1-core?state=4f81feab-35f7-e97e-9903-52510f8542bd) is a CLI tool that inspects your system and installs the infrastructure agent alongside the application monitoring agent that best works for your system. To learn more about how our guided install works, check out our [Guided install overview](/docs/infrastructure/host-integrations/installation/new-relic-guided-install-overview). -* If you'd rather install our infrastructure agent manually, you can follow a tutorial for manual installation for [Linux](/docs/infrastructure/install-infrastructure-agent/linux-installation/install-infrastructure-monitoring-agent-linux), [Windows](/docs/infrastructure/install-infrastructure-agent/windows-installation/install-infrastructure-monitoring-agent-windows/), or [macOS](/docs/infrastructure/install-infrastructure-agent/macos-installation/install-infrastructure-monitoring-agent-macos/). +## Set up the Postfix integration +Complete the following steps to set up the Postfix integration: + + +## Install the infrastructure agent [#infra-install] +To use the Postfix integration, you need to also [install the infrastructure agent](/docs/infrastructure/install-infrastructure-agent/get-started/install-infrastructure-agent-new-relic/) on the same host. The infrastructure agent monitors the host itself, while the integration you'll install in the next step extends your monitoring with Postfix-specific data. + + ## Export Postfix data [#export] -Use `pflogsumm` to export your Postfix metrics. `Pflogsumm` is a log analyzer for Postfix agent and designed to provide an overview of Postfix activity, with just enough detail to give the administrator a "heads up" for potential trouble spots. +Export your Postfix metrics with `pflogsumm`. The Postfix agent uses`pflogsumm` as a log analyzer, which translates into metric data about your Postfix activity. This gives you enough detail to anticipate potential incidences with email administration. Follow these steps to use `pflogsumm`. - - Download pflogsumm} - > - 1. Run the following command to use `pflogsumm`: + 1. Run the following commands to download and extract `pflogsumm`: ```shell wget https://jimsun.linxnet.com/downloads/pflogsumm-1.1.3.tar.gz ``` - 2. Extract the downloaded file. - ```shell tar xvf pflogsumm-1.1.3.tar.gz ``` - 3. Navigate to the `pflogsumm` folder. + 2. Go to the `pflogsumm` folder. ```shell cd pflogsumm-*.*.* ``` - 4. Copy the `pflogsumm.pl` file to the path `/usr/local/bin/pflogsumm` : + + 3. Copy the `pflogsumm.pl` file to the path `/usr/local/bin/pflogsumm` : ```shell sudo cp pflogsumm.pl /usr/local/bin/pflogsumm ``` - - - Run pflogsumm commands to get the Postfix metrics} - > + 4. Run the following `pflogsumm` commands to export the Postfix metrics: ```shell cat /var/log/mail.log | pflogsumm cat /var/log/mail.log | pflogsumm -d today - ``` - - - - - + ``` + + ## Configure NRI-Flex for Postfix -Flex comes bundled with the New Relic infrastructure agent. To create a flex configuration file follow these steps: +Flex, our application-agnostic monitoring tool, comes bundled with the New Relic infrastructure agent. Follow these steps to create a flex configuration file for your Postfix data: -1. Create a file named `postfix-flex-config.yml` in this path: +1. Create a file named `postfix-flex-config.yml`: ```shell - /etc/newrelic-infra/integrations.d + touch /etc/newrelic-infra/integrations.d/postfix-flex-config.yml ``` -2. Update the file `postfix-flex-config.yml` with these configurations: - * `EVENT_TYPE`: You can consider `EVENT_TYPE` as a New Relic database table that you can query using NRQL. - * `COMMAND`: This contains the command which is used to print metrics on the terminal. - - Once your configuration file is updated, it will look like below: - -```yml - --- - integrations: - - name: nri-flex - config: - name: postfixFlex - apis: - #check if Postfix service is up. - - event_type: PostfixUp - commands: - - run: echo "value:$(systemctl status postfix | grep 'Active':' active' | wc -l)" - split_by: ':' - - #check if Postfix service is down. - - event_type: PostfixDown - commands: - - run: echo "value:$(systemctl status postfix | grep 'Active':' active' | wc -l)" - split_by: ':' - - #Read the grand totals messages by using the below script. - - event_type: PostfixGrandTotals - commands: - - run: cat /var/log/mail.log | pflogsumm | grep -A 21 'Grand Totals' - split: horizontal - set_header: [metricValue, message] - regex_match: true - split_by: \s+(\d+\w*)\s+(.*) - - #Read the number of messages delivered & received in bytes. - - event_type: PostfixMessageBytes - commands: - - run: cat /var/log/mail.log | pflogsumm | grep -A 1 'bytes received' - split: horizontal - set_header: [metricValue, messageBytes] - regex_match: true - split_by: \s+(\d+\w*)\s+(.*) - - #Read the number of messages held by the user. - - event_type: PostfixHeldMessage - commands: - - run: echo "value:$(cat /var/mail/ | grep -c 'Subject:')" - split_by: ':' - - #Read the count of SASL authentication failure notifications. - - event_type: PostfixSASLauthFailed - commands: - - run: echo "value:$(cat /var/log/mail.log | grep 'status=deferred (SASL authentication failed' | wc -l)" - split_by: ':' - - #Read the count of bounced non-delivery notifications. - - event_type: PostfixBounceNondeliveryNotification - commands: - - run: echo "value:$(cat /var/log/mail.log | grep 'postfix/bounce' | wc -l)" - split_by: ':' - - #Read the number of messages passed through the email delivery process. - - event_type: PostfixEmailDeliveryProcess - commands: - - run: echo "PICKUPvalue:$(cat /var/log/mail.log | grep 'pickup' | wc -l)" - split_by: ':' - - run: echo "CLEANUPvalue:$(cat /var/log/mail.log | grep 'cleanup' | wc -l)" - split_by: ':' - - #Read the number of message inserted in mail queue. - - event_type: PostfixMessageInsertedinMailQ - commands: - - run: echo "Ivalue:$(cat /var/log/mail.log | grep 'queue active'| wc -l)" - split_by: ':' - - #Read the number of message handled by SMTP process. - - event_type: PostfixMessageHandledBySMTP - commands: - - run: echo "SENTmsg:$(cat /var/log/mail.log | grep 'status=sent' | grep "postfix/smtp" | wc -l)" - split_by: ':' - - run: echo "BOUNCEDmsg:$(cat /var/log/mail.log | grep 'status=bounced' | grep "postfix/smtp" | wc -l)" - split_by: ':' - - run: echo "DEFERREDmsg:$(cat /var/log/mail.log | grep 'status=deferred' | grep "postfix/smtp" | wc -l)" - split_by: ':' - - #Read the number of message removed from mail queue. - - event_type: PostfixMessageRemovedFromMailQ - commands: - - run: echo "Rvalue:$(cat /var/log/mail.log | grep 'removed'| wc -l)" - split_by: ':' - - #Read the number of SMTPD connection. - - event_type: PostfixSMTPDconnection - commands: - - run: echo "value:$(cat /var/log/mail.log | grep ' connect from' | wc -l)" - split_by: ':' - - #Read the number of SMTPD disconnection. - - event_type: PostfixSMTPDdisconnection - commands: - - run: echo "value:$(cat /var/log/mail.log | grep 'disconnect from' | wc -l)" - split_by: ':' - - #Read the number of SMTP connection. - - event_type: PostfixSMTPconnection - commands: - - run: echo "value:$(cat /var/log/mail.log | grep ' connect to' | wc -l)" - split_by: ':' - - #Read the number of SMTP disconnection. - - event_type: PostfixSMTPdisconnection - commands: - - run: echo "value:$(cat /var/log/mail.log | grep 'disconnect to' | wc -l)" - split_by: ':' - - #Read the number of connection timed out. - - event_type: PostfixSMTPDtimedOut - commands: - - run: echo "value:$(cat /var/log/mail.log | grep 'timeout after CONNECT' | wc -l)" - split_by: ':' - - #Read the number of connection lost. - - event_type: PostfixSMTPDconnectionLost - commands: - - run: echo "value:$(cat /var/log/mail.log | grep 'lost connection' | wc -l)" - split_by: ':' - - #Read the per-hour traffic report. - - event_type: PostfixMessagePerHourReport - commands: - - run: cat /var/log/mail.log | pflogsumm -d today | grep -i 'Per-Hour Traffic Summary' -A 27 - split: horizontal - header_split_by: \s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(.*) - set_header: - [ - time, - received.perhour, - delivered.perhour, - deferred.perhour, - bounced.perhour, - rejected.perhour, - ] - regex_match: true - split_by: \s+(\d+-\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+) - - #Read the per-day traffic summary. - - event_type: PostfixMessageTrafficPerDay - commands: - - run: cat /var/log/mail.log | pflogsumm --zero_fill | grep -C 12 'Per-Day Traffic Summary' -B 0 -A 8 | sed '/Per-Hour Traffic Daily Average/q' - split: horizontal - header_split_by: \s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(.*) - set_header: - [date, received, delivered, deferred, bounced, rejected] - regex_match: true - split_by: \s+(\w+\s+\d+\s+\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+) - - #Read the host/domain summary: message delivery & received. - - event_type: PostfixHostSummary - commands: - - run: cat /var/log/mail.log | pflogsumm | grep -i 'Host/Domain Summary':' Message Delivery' -A 8 | sed -n '2,9p' - split: horizontal - header_split_by: \s+(\w+\s+\w+)\s+(\w+)\s+(\w+)\s+(\w+\s+\w+)\s+(\w+\s+\w+)\s+(.*.) - set_header: - [sentCount, bytesDelivered, defers, avgDaily, maxDaily, host] - regex_match: true - split_by: \s+(\d+)\s+(\d+\w*)\s+(\d+)\s+(\d+.\d+\s+\w)\s+(\d+.\d+\s+\w)\s+(.*) - - run: cat /var/log/mail.log | pflogsumm | grep -A 15 'Host/Domain Summary':' Messages Received' | sed '/Senders by message count/q' - split: horizontal - header_split_by: \s+(\w+\s+\w+)\s+(\w+)\s+(.*.) - set_header: [msgCount, bytesReceived, hostDetail] - regex_match: true - split_by: \s+(\d+)\s+(\d+\w*)\s+(.*) - - #Read the senders & recipients with message count. - - event_type: PostfixSenderRecipientMessageCount - commands: - - run: cat /var/log/mail.log | pflogsumm | grep -C 11 'Senders by message count' -B 1 -A 9 | sed '/Recipients by message count/q' - split: horizontal - header_split_by: (.*.) - set_header: [sender.msgCount, senders] - regex_match: true - split_by: \s+(\d+)\s+(.*) - - run: cat /var/log/mail.log | pflogsumm | grep -C 11 'Recipients by message count' -B 1 -A 9 | sed '/Senders by message size/q' - split: horizontal - header_split_by: (.*.) - set_header: [recipient.msgCount, recipients] - regex_match: true - split_by: \s+(\d+)\s+(.*) - - #Read the daemon message details. - - event_type: PostfixDaemonMessage - commands: - - run: cat /var/log/mail.log | pflogsumm | grep -A 10 'Master daemon messages' - split: horizontal - set_header: [daemon.msgCount, daemonMessage] - regex_match: true - split_by: \s*(\d+)\s+(\w+.*.) - - #Read the message deferral details. - - event_type: PostfixDeferralMessage - commands: - - run: cat /var/log/mail.log | pflogsumm | grep -A 15 'message deferral detail' | sed '/message bounce detail (by relay)/q' - split: horizontal - header_split_by: (\s+\w+\s+.*) - set_header: [deferral.msgCount, deferralMessage] - regex_match: true - split_by: \s*(\d+)\s+(\w+.*.) - - #Read the warning message details. - - event_type: PostfixWarningMessage - commands: - - run: cat /var/log/mail.log | pflogsumm | grep -v 'mail_queue_enter' | grep -C 100 'Warnings' -B 1 -A 10 | sed '/Fatal Errors/q' - split: horizontal - header_split_by: \s+(\w+)\s+(.*) - set_header: [Warning.msgCount, warningMessage] - regex_match: true - split_by: \s*(\d+)\s\s\s(.*.) - - #Read the error message details. - - event_type: PostfixErrorMessage - commands: - - run: cat /var/log/mail.log | pflogsumm | grep -C 15 'Fatal Errors' -B 1 -A 10 | sed '/Panics/q' - split: horizontal - header_split_by: \s+(\w+)\s+(.*) - set_header: [Fatal.msgCount, fatalMessage] - regex_match: true - split_by: \s*(\d+)\s\s\s(.*.) - - #Read the message bounce details. - - event_type: PostfixBounceMessage - commands: - - run: cat /var/log/mail.log | pflogsumm | grep -A 10 'message bounce detail (by relay)' | sed '/message reject detail/q' - split: horizontal - header_split_by: \s+(\w+)\s+(.*) - set_header: [Bounce.msgCount, bounceMessage] - regex_match: true - split_by: \s*(\d+)\s\s\s(.*.) -``` - +2. Update the file `postfix-flex-config.yml`. We recommend you work off our configuration sample below: + + ```yml + --- + integrations: + - name: nri-flex + config: + name: postfixFlex + apis: + #check if Postfix service is up. + - event_type: PostfixUp + commands: + - run: echo "value:$(systemctl status postfix | grep 'Active':' active' | wc -l)" + split_by: ':' + + #check if Postfix service is down. + - event_type: PostfixDown + commands: + - run: echo "value:$(systemctl status postfix | grep 'Active':' active' | wc -l)" + split_by: ':' + + #Read the grand totals messages by using the below script. + - event_type: PostfixGrandTotals + commands: + - run: cat /var/log/mail.log | pflogsumm | grep -A 21 'Grand Totals' + split: horizontal + set_header: [metricValue, message] + regex_match: true + split_by: \s+(\d+\w*)\s+(.*) + + #Read the number of messages delivered & received in bytes. + - event_type: PostfixMessageBytes + commands: + - run: cat /var/log/mail.log | pflogsumm | grep -A 1 'bytes received' + split: horizontal + set_header: [metricValue, messageBytes] + regex_match: true + split_by: \s+(\d+\w*)\s+(.*) + + #Read the number of messages held by the user. + - event_type: PostfixHeldMessage + commands: + - run: echo "value:$(cat /var/mail/ | grep -c 'Subject:')" + split_by: ':' + + #Read the count of SASL authentication failure notifications. + - event_type: PostfixSASLauthFailed + commands: + - run: echo "value:$(cat /var/log/mail.log | grep 'status=deferred (SASL authentication failed' | wc -l)" + split_by: ':' + + #Read the count of bounced non-delivery notifications. + - event_type: PostfixBounceNondeliveryNotification + commands: + - run: echo "value:$(cat /var/log/mail.log | grep 'postfix/bounce' | wc -l)" + split_by: ':' + + #Read the number of messages passed through the email delivery process. + - event_type: PostfixEmailDeliveryProcess + commands: + - run: echo "PICKUPvalue:$(cat /var/log/mail.log | grep 'pickup' | wc -l)" + split_by: ':' + - run: echo "CLEANUPvalue:$(cat /var/log/mail.log | grep 'cleanup' | wc -l)" + split_by: ':' + + #Read the number of message inserted in mail queue. + - event_type: PostfixMessageInsertedinMailQ + commands: + - run: echo "Ivalue:$(cat /var/log/mail.log | grep 'queue active'| wc -l)" + split_by: ':' + + #Read the number of message handled by SMTP process. + - event_type: PostfixMessageHandledBySMTP + commands: + - run: echo "SENTmsg:$(cat /var/log/mail.log | grep 'status=sent' | grep "postfix/smtp" | wc -l)" + split_by: ':' + - run: echo "BOUNCEDmsg:$(cat /var/log/mail.log | grep 'status=bounced' | grep "postfix/smtp" | wc -l)" + split_by: ':' + - run: echo "DEFERREDmsg:$(cat /var/log/mail.log | grep 'status=deferred' | grep "postfix/smtp" | wc -l)" + split_by: ':' + + #Read the number of message removed from mail queue. + - event_type: PostfixMessageRemovedFromMailQ + commands: + - run: echo "Rvalue:$(cat /var/log/mail.log | grep 'removed'| wc -l)" + split_by: ':' + + #Read the number of SMTPD connection. + - event_type: PostfixSMTPDconnection + commands: + - run: echo "value:$(cat /var/log/mail.log | grep ' connect from' | wc -l)" + split_by: ':' + + #Read the number of SMTPD disconnection. + - event_type: PostfixSMTPDdisconnection + commands: + - run: echo "value:$(cat /var/log/mail.log | grep 'disconnect from' | wc -l)" + split_by: ':' + + #Read the number of SMTP connection. + - event_type: PostfixSMTPconnection + commands: + - run: echo "value:$(cat /var/log/mail.log | grep ' connect to' | wc -l)" + split_by: ':' + + #Read the number of SMTP disconnection. + - event_type: PostfixSMTPdisconnection + commands: + - run: echo "value:$(cat /var/log/mail.log | grep 'disconnect to' | wc -l)" + split_by: ':' + + #Read the number of connection timed out. + - event_type: PostfixSMTPDtimedOut + commands: + - run: echo "value:$(cat /var/log/mail.log | grep 'timeout after CONNECT' | wc -l)" + split_by: ':' + + #Read the number of connection lost. + - event_type: PostfixSMTPDconnectionLost + commands: + - run: echo "value:$(cat /var/log/mail.log | grep 'lost connection' | wc -l)" + split_by: ':' + + #Read the per-hour traffic report. + - event_type: PostfixMessagePerHourReport + commands: + - run: cat /var/log/mail.log | pflogsumm -d today | grep -i 'Per-Hour Traffic Summary' -A 27 + split: horizontal + header_split_by: \s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(.*) + set_header: + [ + time, + received.perhour, + delivered.perhour, + deferred.perhour, + bounced.perhour, + rejected.perhour, + ] + regex_match: true + split_by: \s+(\d+-\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+) + + #Read the per-day traffic summary. + - event_type: PostfixMessageTrafficPerDay + commands: + - run: cat /var/log/mail.log | pflogsumm --zero_fill | grep -C 12 'Per-Day Traffic Summary' -B 0 -A 8 | sed '/Per-Hour Traffic Daily Average/q' + split: horizontal + header_split_by: \s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(.*) + set_header: + [date, received, delivered, deferred, bounced, rejected] + regex_match: true + split_by: \s+(\w+\s+\d+\s+\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+) + + #Read the host/domain summary: message delivery & received. + - event_type: PostfixHostSummary + commands: + - run: cat /var/log/mail.log | pflogsumm | grep -i 'Host/Domain Summary':' Message Delivery' -A 8 | sed -n '2,9p' + split: horizontal + header_split_by: \s+(\w+\s+\w+)\s+(\w+)\s+(\w+)\s+(\w+\s+\w+)\s+(\w+\s+\w+)\s+(.*.) + set_header: + [sentCount, bytesDelivered, defers, avgDaily, maxDaily, host] + regex_match: true + split_by: \s+(\d+)\s+(\d+\w*)\s+(\d+)\s+(\d+.\d+\s+\w)\s+(\d+.\d+\s+\w)\s+(.*) + - run: cat /var/log/mail.log | pflogsumm | grep -A 15 'Host/Domain Summary':' Messages Received' | sed '/Senders by message count/q' + split: horizontal + header_split_by: \s+(\w+\s+\w+)\s+(\w+)\s+(.*.) + set_header: [msgCount, bytesReceived, hostDetail] + regex_match: true + split_by: \s+(\d+)\s+(\d+\w*)\s+(.*) + + #Read the senders & recipients with message count. + - event_type: PostfixSenderRecipientMessageCount + commands: + - run: cat /var/log/mail.log | pflogsumm | grep -C 11 'Senders by message count' -B 1 -A 9 | sed '/Recipients by message count/q' + split: horizontal + header_split_by: (.*.) + set_header: [sender.msgCount, senders] + regex_match: true + split_by: \s+(\d+)\s+(.*) + - run: cat /var/log/mail.log | pflogsumm | grep -C 11 'Recipients by message count' -B 1 -A 9 | sed '/Senders by message size/q' + split: horizontal + header_split_by: (.*.) + set_header: [recipient.msgCount, recipients] + regex_match: true + split_by: \s+(\d+)\s+(.*) + + #Read the daemon message details. + - event_type: PostfixDaemonMessage + commands: + - run: cat /var/log/mail.log | pflogsumm | grep -A 10 'Master daemon messages' + split: horizontal + set_header: [daemon.msgCount, daemonMessage] + regex_match: true + split_by: \s*(\d+)\s+(\w+.*.) + + #Read the message deferral details. + - event_type: PostfixDeferralMessage + commands: + - run: cat /var/log/mail.log | pflogsumm | grep -A 15 'message deferral detail' | sed '/message bounce detail (by relay)/q' + split: horizontal + header_split_by: (\s+\w+\s+.*) + set_header: [deferral.msgCount, deferralMessage] + regex_match: true + split_by: \s*(\d+)\s+(\w+.*.) + + #Read the warning message details. + - event_type: PostfixWarningMessage + commands: + - run: cat /var/log/mail.log | pflogsumm | grep -v 'mail_queue_enter' | grep -C 100 'Warnings' -B 1 -A 10 | sed '/Fatal Errors/q' + split: horizontal + header_split_by: \s+(\w+)\s+(.*) + set_header: [Warning.msgCount, warningMessage] + regex_match: true + split_by: \s*(\d+)\s\s\s(.*.) + + #Read the error message details. + - event_type: PostfixErrorMessage + commands: + - run: cat /var/log/mail.log | pflogsumm | grep -C 15 'Fatal Errors' -B 1 -A 10 | sed '/Panics/q' + split: horizontal + header_split_by: \s+(\w+)\s+(.*) + set_header: [Fatal.msgCount, fatalMessage] + regex_match: true + split_by: \s*(\d+)\s\s\s(.*.) + + #Read the message bounce details. + - event_type: PostfixBounceMessage + commands: + - run: cat /var/log/mail.log | pflogsumm | grep -A 10 'message bounce detail (by relay)' | sed '/message reject detail/q' + split: horizontal + header_split_by: \s+(\w+)\s+(.*) + set_header: [Bounce.msgCount, bounceMessage] + regex_match: true + split_by: \s*(\d+)\s\s\s(.*.) + ``` + If you'd prefer to make your own, then make sure that your yaml file follows the pattern above. Edit the following attributes as needed: + * `EVENT_TYPE`: A New Relic database table that you can query using NRQL. + * `COMMAND`: The command used to print metrics on the terminal. + + ## Forward your Postfix logs to New Relic - -You can use our [log forwarding](/docs/logs/forward-logs/forward-your-logs-using-infrastructure-agent/) to forward Postfix logs to New Relic. -On Linux machines, your log file named `logging.yml` should be present in this path: +Follow these steps to forward Postfix logs to New Relic: -```shell -/etc/newrelic-infra/logging.d/ -``` +1. Create a file named `logging.yml` in the infrastructure agent directory: -After creating the log file, add the following script to the `logging.yml` file: + ```shell + touch /etc/newrelic-infra/logging.d/logging.yml + ``` -```yml -logs: - - name: mail.log - file: /var/log/mail.log - attributes: - logtype: postfix_maillog -``` +2. Add the following snippet to the `logging.yml` file: -## Restart the New Relic infrastructure agent + ```yml + logs: + - name: mail.log + file: /var/log/mail.log + attributes: + logtype: postfix_maillog + ``` + + +## Restart the infrastructure agent [#restart-infra] -Before you can start reading your data, use the instructions in our [infrastructure agent docs](/docs/infrastructure/install-infrastructure-agent/manage-your-agent/start-stop-restart-infrastructure-agent/) to restart your infrastructure agent. +Use the instructions in our [infrastructure agent docs](/docs/infrastructure/install-infrastructure-agent/manage-your-agent/start-stop-restart-infrastructure-agent/) to restart your infrastructure agent. This is a basic command that should work for most people: ```shell sudo systemctl restart newrelic-infra.service -``` -In couple of minutes, your application will send metrics to [one.newrelic.com](https://one.newrelic.com). +``` + + +## Find and use data +Follow these steps to use our pre-built dashboard template to easily view your Postfix data: -## Monitor your application - -You can choose our pre-built dashboard template named `Postfix` to monitor your Postfix application metrics. Follow these steps to use our pre-built dashboard template: - -1. Go to **[one.newrelic.com](https://one.newrelic.com/)** and click on **+ Add data**. +1. Go to **[one.newrelic.com](https://one.newrelic.com/)** and click on **+ Add data**. 2. Click on the **Dashboards** tab. 3. In the search box, type `Postfix`. 4. When you see our pre-build dashboard, click on it to install it in your account. -Your Postfix dashboard is considered a custom dashboard and can be found in the **Dashboards** UI. For docs on using and editing dashboards, see [our dashboard docs](/docs/query-your-data/explore-query-data/dashboards/introduction-dashboards). +Your Postfix dashboard is a custom dashboard. Access it from the **Dashboards** UI. For docs on using and editing dashboards, see [our dashboard docs](/docs/query-your-data/explore-query-data/dashboards/introduction-dashboards). -Here is a NRQL query to view your latest message record's status: - -```sql -SELECT * -FROM PostfixGrandTotals -``` - - -Here is a NRQL query to view your per-hour message records: - -```sql -SELECT * -FROM PostfixMessagePerHourReport -``` +For more on how to find and use your data, see [Understand integration data](/docs/infrastructure/integrations/find-use-infrastructure-integration-data). Here's a few example NRQL queries for Postfix data: + + + ```sql + SELECT * + FROM PostfixGrandTotals + ``` + + + ```sql + SELECT * + FROM PostfixMessagePerHourReport + ``` + + + + + + ## What's next? @@ -399,5 +393,3 @@ To learn more about building NRQL queries and generating dashboards, check out t * [Introduction to the query builder](/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder) to create basic and advanced queries. * [Introduction to dashboards](/docs/query-your-data/explore-query-data/dashboards/introduction-dashboards) to customize your dashboard and carry out different actions. * [Manage your dashboard](/docs/query-your-data/explore-query-data/dashboards/manage-your-dashboard) to adjust your display mode, or to add more content to your dashboard. - -