Services type
Defines named services, service endpoints, and supervisord configuration parameters.
The parameters in your services block in your app's manifest file can be divided into these types:
- Service definition parameters
- The service name, version, and any endpoints that are defined for the service.
- Endpoints field parameters
- A breakdown of the endpoints subparameters.
- Supervisord configuration parameters
- A list of parameters that can be passed to supervisord to control the service process.
The following code sample lists the services block fields:
{
...
"services": [
{
"name":"some_service",
"version":"1.0",
"endpoints": [
{ "name":"something",
"path":"get_something/{id}",
"http_method": "GET",
"parameters": [
{
"location": "PATH",
"name": "id"
"definition": "String"
}
]
}
],
"command":"/usr/bin/python loop.py",
"process_name":"%(program_name)s",
"numprocs":1,
"directory":"/src_deps/services/",
"umask":"022",
"priority":999,
"autostart":"true",
"autorestart":"true",
"startsecs":1,
"startretries":3,
"exitcodes":"0,2",
"stopsignal":"TERM",
"stopwaitsecs":8,
"user":"root",
"redirect_stderr":"true",
"stdout_logfile":"/store/log/pro.log",
"stdout_logfile_maxbytes":"1MB",
"stdout_logfile_backups":7,
"stdout_capture_maxbytes":"0",
"stdout_events_enabled":"false",
"stderr_logfile":"/store/log/proerr.log",
"stderr_logfile_maxbytes":"1MB",
"stderr_logfile_backups":6,
"stderr_capture_maxbytes":"0",
"stderr_events_enabled":"false",
"environment":"PY_HOME=/usr/bin/python",
"serverurl":"AUTO"
}
],
...
}
The following tables provide details about the manifest fields for the services block.
Field | Required | Type | Description |
---|---|---|---|
name | Yes | String | The name of the service instance. |
version | Yes | String |
Version of this named service that is supported by this instance. Only one version per named service definition is allowed. |
endpoints | No | Array of Endpoints type | The endpoints that are defined for this service instance. You can define a number of parameters for each endpoint. For more information about endpoint parameters, see Table 2 |
Endpoints field parameters
The endpoints field parameters are explained in more detail in the following table:
Parameter | Required | Type | Description |
---|---|---|---|
name | Yes | String | The name of the endpoint. |
http_method | Yes | String | The HTTP method to use for the request: GET, POST, PUT, or DELETE. |
path | Yes | String | The URL that is used to access endpoint. |
request_mime_type | No | String | The mime type of request body. Provide this value when your request has a body (POST, PUT). Typical values include these strings: "application/json", "application/json+ld", "application/x-www-form-urlencoded". |
request_body_type | No | Object | Provides a JSON object that defines the structure of your request body. If you use this parameter, do not set the location parameter to BODY. |
parameters | No | Array |
|
response | No | Object | Definition of the expected response. If your endpoint does not return a response body, then
omit this field.
|
error_mime_type | No | String | The mime type of error message body. Defaults to text/plain. |
Supervisord configuration parameter fields
The QRadar® Application Framework uses supervisord to monitor and control named services. You can specify supervisord configuration parameters as fields within the services block in your app's manifest file.
You can use the following supervisord parameters as fields in the services block. For more information about supervisord configuration parameters, see http://supervisord.org/configuration.html (http://supervisord.org/configuration.html).
Field | Required | Type | Description |
---|---|---|---|
port | No | Integer | A TCP host:port value, for example, 127.0.0.1:9001 on which supervisor listens for HTTP and
XML-RPC requests. If no port is specified the service is treated as a headless background process that runs continuously. |
command | No | String | The command that runs when this program is started. The command can be either absolute, for example, /path/to/program or relative, for example, program. If it is relative, the supervisord’s environment $PATH is searched for the executable. |
directory | No | The path to the directory that supervisord changes to before it executes the child process. | |
autorestart | No | Enum |
Specifies whether supervisord automatically restarts a process when it exits in the RUNNING state. Value is one of the following states: TRUE, FALSE, UNEXPECTED. |
process_name | No | String | A Python string that is used for the supervisor process name. |
numprocs | No | String | The number of instances of the program the supervisor starts. |
umask | No | String | The octal number that represents the umask of the process. |
autostart | No | Enum | Value is TRUE or FALSE. If TRUE, this program starts automatically when supervisord is started. |
startsecs | No | Integer | The number of seconds that the program needs to stay running after startup to consider the start successful. |
startretries | No | Integer | The number of serial failure attempts that supervisord allows when it attempts to start the program. |
exitcodes | No | String | The list of expected exit codes for this program that are used with autorestart. |
stopsignal | No | String | The signal that is used to kill the program when a stop is requested. Use any of the following:
|
stopwaitsecs | No | Integer | The number of seconds to wait for the operating system to return a SIGCHLD to supervisord after the program is sent a stopsignal. |
user | No | String | The UNIX user account that runs the program. |
redirect_stderr | No | Enum | Value is either TRUE or FALSE. If TRUE, causes the StdErr output to be sent back to supervisord on its StdOut file descriptor. |
stdout_logfile | No | String | StdOut output is stored in this file. If redirect_stderr is TRUE, StdErr output is also stored in this file). |
stdout_logfile_maxbytes | No | String | The maximum number of bytes that can be consumed by stdout_logfile before it is rotated and a new log file is started. |
stdout_logfile_backups | No | Integer | The number of stdout_logfile backups to retain from the StdOut log file rotation. |
stdout_capture_maxbytes | No | String | The maximum number of bytes that are written to capture FIFO (first in, first out) when the process is in StdOut capture mode. |
stdout_events_enabled | No | Enum | Value is one of TRUE, FALSE. If TRUE, PROCESS_LOG_STDOUT events are emitted when the process writes to its StdOut file descriptor. |
StdErr_logfile | No | String | Put process StdErr output in this file unless redirect_stderr is TRUE. |
stderr_logfile_maxbytes | No | String | The maximum number of bytes before log file rotation for stderr_logfile. |
stderr_logfile_backups | No | Integer | The number of stderr_logfile backups to retain from the StdErr log file rotation. |
stderr_capture_maxbytes | No | String | The maximum number of bytes that are written to capture FIFO (first in, first out) when the process is in StdErr capture mode. |
stderr_events_enabled | No | Enum | Value is either TRUE or FALSE. If TRUE, PROCESS_LOG_STDERR events are generated when the process writes to its StdErr file descriptor. |
environment | No | String | A list of key/value pairs, in the form KEY="val",KEY2="val2", that are placed in the child process’ environment. |
serverurl | No | String | The URL that is used to access the supervisord server, for example, http://localhost:9001 |