Friday, 13 March 2026

Named pipe real time example

 

Real-Time Oracle Alert Log Monitoring Using Named Pipes (FIFO)

In this article, we will build a simple real-time Oracle alert log monitoring system using Linux named pipes (FIFO) and a small Bash script.

The idea is simple:

  • Stream the Oracle alert log

  • Send the stream into a named pipe

  • A listener script ("Brain") reads the pipe

  • When an ORA- error appears, it is immediately captured and logged

This approach allows real-time monitoring without continuously scanning files, and demonstrates a practical use of named pipes in DBA automation.


Step 1 — Create the Named Pipe

First create a FIFO pipe that will act as the communication channel between the log feeder and the monitoring script.

[oracle@oelggvm01 pump]$ mkfifo /tmp/alert_monitor.fifo

This pipe will receive log entries from the Oracle alert log.


Step 2 — Start the "Brain" (The Listener)

Now create a script that continuously reads from the pipe and checks for Oracle errors.

[oracle@oelggvm01 pump]$
[oracle@oelggvm01 pump]$ vi 01-monitor-alertlog.sh
[oracle@oelggvm01 pump]$ cat 01-monitor-alertlog.sh
#!/usr/bin/env bash

while read line; do
if [[ "$line" == *"ORA-"* ]]; then
echo "[$(date)] ALERT DETECTED: $line" >> /tmp/critical_errors.log
fi
done < /tmp/alert_monitor.fifo
[oracle@oelggvm01 pump]$

What this script does

  1. Continuously reads lines from the FIFO

  2. Checks if the line contains ORA-

  3. If found, it writes the message to a critical error log

Start the listener in the background:

[oracle@oelggvm01 pump]$ bash 01-monitor-alertlog.sh &
[1] 143232
[oracle@oelggvm01 pump]$

Now the Brain is running and waiting for input.


Step 3 — Start the "Feeder"

Next, stream the Oracle alert log into the named pipe.

[oracle@oelggvm01 pump]$ tail -f $ORACLE_BASE/diag/rdbms/*/*/trace/alert*.log > /tmp/alert_monitor.fifo &
[1] 143247
[oracle@oelggvm01 pump]$

Now the pipeline looks like this:

Oracle alert log


tail -f


alert_monitor.fifo


listener script


critical_errors.log

Step 4 — Simulate an Oracle Error

To test the monitoring system, append a fake ORA error to the alert log.

[oracle@oelggvm01 pump]$ echo "ORA-600 my new error" >> /u01/app/oracle/diag/rdbms/oggdb/OGDDB/trace/alert_OGDDB.log

Step 5 — Verify the Detection

Now check the critical error log.

[oracle@oelggvm01 pump]$ tail -f /tmp/critical_errors.log
[Sun Mar 15 01:00:42 AM IST 2026] ALERT DETECTED: ORA-600
[Sun Mar 15 01:01:15 AM IST 2026] ALERT DETECTED: ORA-600 my new error

The listener immediately captured the error in real time.


How the Architecture Works

This simple system uses Linux inter-process communication.

tail -f alert.log


Named Pipe (FIFO)


Monitoring Script


Error Log File

Advantages:

  • Real-time monitoring

  • No repeated file scanning

  • Very lightweight

  • Easily extendable for alerts


Possible Enhancements

You can extend this system further by adding:

Email alerts

mail -s "Oracle Error Detected" dba@company.com <<< "$line"

No comments:

Post a Comment

JFrog Artifactory - How to install

JFrog Artifactory OSS Installation Guide CentOS 9 + PostgreSQL 17 This guide provides a structured workflow to install JFrog Artifactory OSS...