IBM Support

Supervisor

How To


Summary

QRadar Apps use Supervisor to manage processes. This system allows developers to provide configuration files to define how processes in apps should run.

Steps

Supervisor Use-Cases

Supervisor should be used when an app requires background processes that are not exposed outside of the container, for example a PostgreSQL database running in the app container, or a background script that processes app data in an asynchronous manner.

Supervisor And Named Services

A named service allows apps to register a service that other apps and the QRadar UI could use. Named service definitions provide the ability to specify a command to execute - QRadar uses the named service definition to generate a Supervisor configuration file; it is good practice to not mix these, if the process can be fully defined by a named service then use the named service definition instead of an additional Supervisor configuration.

Supervisor Overview

QRadar apps use Supervisor version 4.1.0.

QRadar apps have the following components of Supervisor installed:

  • The Supervisor server, called supervisord - this handles actually starting and managing processes.
  • The Supervisor command line, called supervisorctl - this provides a shell interface for interacting with Supervisor.

Providing a Supervisor Configuration

Supervisor configuration is provided by creating .conf configuration files in the container/conf/supervisord.d directory. This container/conf/supervisord.d directory holds Supervisor configuration and all configuration in this directory is copied into /etc/supervisord.d on startup. These configuration files are linked in to the QRadar app Supervisor configuration using the include configuration option of Supervisor, allowing all configuration to be picked up and processed.

This configuration is then processed by Supervisor - processes are started and configured; and continuously managed, allowing for automatic restarts if the process exits.

Any Supervisor configuration can be added to this directory, allowing flexiblity in how apps manage processes.

Examples

QRadar apps support any valid configuration of Supervisor, beyond running simple programs. Outlined here are some simple examples of Supervisor configuration. To see more in-depth documentation of how to configure Supervisor, please consult the Supervisor documentation.

Please note these are only examples of the Supervisor configuration, and as such are not standalone and fully functional - they require more configuration, dependencies and code.

Running a PostgreSQL Database

This is an example running a PostgreSQL database.

[program:postgres]
command=postgres -D /opt/app-root/store/data
directory=/opt/app-root/app
autostart=true
autorestart=true
stderr_logfile=/opt/app-root/store/log/psql.log
stdout_logfile=/opt/app-root/store/log/psql.log

This configures how standard out and error are handled, the working directory of the process, and handling startup and restart.

Running a Background Script

This is an example running a bash script that runs in the background to process data

[program:background]
command=/bin/bash /opt/app-root/background_script.sh
directory=/opt/app-root/app
autostart=true
autorestart=true
stderr_logfile=/opt/app-root/store/log/background_script.log
stdout_logfile=/opt/app-root/store/log/background_script.log

This configures how standard out and error are handled, the working directory of the process, and handling startup and restart.

Set Supervisord Log Level

This is an example that does not run a program, but instead changes the Supervisord log level.

[supervisord]
loglevel=debug

This sets the Supervisord log level to debug.

Document Location

Worldwide

[{"Line of Business":{"code":"LOB24","label":"Security Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSBQAC","label":"IBM Security QRadar SIEM"},"ARM Category":[{"code":"a8m0z000000cwt3AAA","label":"QRadar Apps"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Document Information

Modified date:
01 October 2021

UID

ibm16437525