Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Syslog Notification Agent

Featured Replies

It would be really convenient to have Syslog as an agent for notifications. Both for local logging but also in my case I have a central syslog server in my homelab.

I wrote one but lost it after an unplanned shutdown, but the code was very simple. Being able to specify server:port would be ideal but it would default to localhost.

Any interest in doing this in-house or should I get back to recreating it and submit it here?

Edited by lhask

  • Author

Other way around - I just want notifications piped to syslog.

Found a version of the script but the actual XML agent I created in /usr/local/emhttp/plugins/dynamix/agents is gone. I cannot compare if this is an early draft or not.

But t's a very simple agent, would be great to see it implemented by Lime themselves. Only need to map notification importance to syslog priority and format it properly. The XML agent UI can also support remote server but default to localhost. I can recreate it if need be, just gauging interest from Lime themselves since agents rely on favicons in another directory and modifying anything in the UnRaid OS itself is too hacky for my taste in a NAS.

MESSAGE="$EVENT: $SUBJECT - $CONTENT"

case "$IMPORTANCE" in

'normal' )

PRIORITY="5"

;;

'warning' )

PRIORITY="4"

;;

'alert' )

PRIORITY="1"

;;

esac

MESSAGE=$(echo -e "$MESSAGE")

logger \

--priority $PRIORITY \

"$MESSAGE"

Edited by lhask
Edited for drunken clarity

I could see a user script pulling the archived / saved notify messages, the data that would get piped to syslog.

If I'm understanding you, you want the syslog to also show a unraid notification and its data in the syslog itself:

image.png

After tracking it down... as a reboot clears theses notfications...

Unraid has a emhttp monitor script and ini files that runs the notfiy script. as we can leverag the notfication scrip tto make a unraid notficaiton... It was then track down where notify saves the unread and archived messages..

root@OMV:/var/local/emhttp# cd /tmp/notifications

root@OMV:/tmp/notifications# ls

archive/ unread/

root@OMV:/tmp/notifications# cd unread/

root@OMV:/tmp/notifications/unread# ls

Docker___MakeMKV_8f67..8850_ticket.notify

root@OMV:/tmp/notifications/unread# cat Docker___MakeMKV_8f67..8850_ticket.notify

timestamp=1766383803

event="Docker - MakeMKV [8f67..8850]"

subject="Notice [OMV] - Version update 8f67..8850"

description="A new version of MakeMKV is available"

importance="normal"

link="/Docker"

root@OMV:/tmp/notifications/unread#

...
So, I will have to re dig at the docs as the agents and system was reworked a bit.

image.png

as theses are saved until a reboot and I dont' see why they couldn't be also apedend or sent to syslog. More trying to remover the path where the txt files are saved.

If i'm understanding your corectly now. as I could see a use case for this especial when diag and a syslog server is running to capture data...


But a user script can be leveraged to move the unread items into syslog and put them in archive...

#!/bin/bash

NOTIFY_DIR="/tmp/notifications"
UNREAD="$NOTIFY_DIR/unread"
ARCHIVE="$NOTIFY_DIR/archive"

[ -d "$UNREAD" ] || exit 0

for file in "$UNREAD"/*.notify; do
  [ -e "$file" ] || continue

  # Reset vars
  timestamp=""
  event=""
  subject=""
  description=""
  importance=""
  message=""
  link=""

  while IFS='=' read -r key val; do
    val="${val%\"}"
    val="${val#\"}"
    case "$key" in
      timestamp)   timestamp="$val" ;;
      event)       event="$val" ;;
      subject)     subject="$val" ;;
      description) description="$val" ;;
      importance)  importance="$val" ;;
      message)     message="$val" ;;
      link)        link="$val" ;;
    esac
  done < "$file"

  # Map importance → syslog priority
  case "$importance" in
    alert)   prio="daemon.err" ;;
    warning) prio="daemon.warning" ;;
    *)       prio="daemon.notice" ;;
  esac

  # Emit to syslog
  logger -p "$prio" -t unraid-notify \
    "event=\"$event\" subject=\"$subject\" desc=\"$description\" msg=\"$message\" link=\"$link\""

  # Move to archive
  mv -f "$file" "$ARCHIVE/"

done

Edited by bmartino1
Data - typo

using this user scirpt i now have my unread notfi message sent to archive and added to syslog

root@OMV:/tmp/notifications# ls archive/

Docker___MakeMKV_8f67..8850_ticket.notify

root@OMV:/tmp/notifications#

image.png

so this is a user scirpt that could be added ot teh notify script to implemnt this wanted interaction of adding notify/notfication into the syslog...

something we can try and request to add to the notify script
/usr/local/emhttp/webGui/scripts/notify


no agent needed...

otherwise as i'm still tsting thigns with unraid and agents.

I think it wounldn't be to hard to interact with teh agents.

/boot/config/plugins/dynamix/notifications/agents/syslog.sh

#!/bin/bash

# Dynamix notification → local syslog agent

case "$IMPORTANCE" in

alert) PRIO="daemon.err" ;;

warning) PRIO="daemon.warning" ;;

*) PRIO="daemon.notice" ;;

esac

logger -p "$PRIO" -t unraid-notify \

"event=\"$EVENT\" subject=\"$SUBJECT\" desc=\"$DESCRIPTION\" msg=\"$CONTENT\" link=\"$LINK\""


To make a agent ...

per squid example work flow:

https://github.com/Squidly271/Wxwork-sample

data per squid:
https://docs.unraid.net/unraid-os/release-notes/7.0.0/#notification-agents

as I think jsut makeing hte script here will auto run with teh agents check marks... I would have to tes this and report back...

  • Author

The simplest solution in the current setup is an alert agent in Unraid itself. And it only requires calling logger with a single command, and would be a checkmarkable agent in the official WebUI.

The code is simple, it's unified, there are no third-party factors or hacks. Just one and done. No monitoring, just an agent that would be called like any other through a simple enabling in the webui.

I tested logger with additional arguments that followed notification data but ultimately priority was the only important part that was worth specifying AFAIR.

Edit: But it should be in notify by default without requiring an agent.

Edited by lhask

  • Author

A drunken non-AI basic agent:

# cat /usr/local/emhttp/plugins/dynamix/agents/Syslog.xml


<?xml version="1.0" encoding="utf-8"?>
  <Agent>
    <Name>Syslog</Name>
    <!--    <Variables>
    </Variables> -->
    <Script>
            <![CDATA[
MESSAGE="$EVENT: $SUBJECT - $CONTENT"
case "$IMPORTANCE" in
'normal' )
        PRIORITY="5"
;;
'warning' )
        PRIORITY="4"
;;
'alert' )
        PRIORITY="1"
;;
esac
MESSAGE=$(echo -e "$MESSAGE")
logger \
        --priority $PRIORITY \
        "$MESSAGE"
      ]]>
    </Script>
  </Agent>

An intern can implement this in an afternoon but with a proper review and added fields for optional remote server.

Edited by lhask

  • Author

I have no idea why notifications are hidden away from system logs and don't automatically go to Syslog by default so complete agreement there btw. the notify script should be doing it by default.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.