Run as a Service

In production, it is recommended to run the Intelligence Hub as a service, so that it starts automatically during system boot-up and continues running when no user is signed in.

Windows

Install the Service

To install the Intelligence Hub as a service, run the runtime\service\install-windows-service.bat script. Note, this feature requires Java to be in the system PATH environment variable. If you are unsure if this was set when you installed Java check out this link: https://www.java.com/en/download/help/path.html .

Once installed, the service can be found in Windows Services Manager under the name HighByte Intelligence Hub Runtime.

Uninstall the Service

Executing the file runtime\service\uninstall-windows-service.bat will stop and uninstall the service.

Service Configuration

The Windows service is configured by runtime\service\service-installer-windows.xml. The installer reads this file when the service is created, and the service re-reads it every time it starts.

ElementDescription
idThe service name used internally by Windows. It must be unique across the system.
nameThe display name shown in the Windows Services Manager.
descriptionThe description shown in the Windows Services Manager.
logmodeControls how the service log files are rotated. See Log Rotation Modes .
logpathThe directory that holds the service log files, relative to runtime\service.
startmodeWhen Windows starts the service. Automatic starts it during boot-up.
executableThe script the service runs, which calls the standard start-windows.bat and stop-windows.bat scripts.
startargumentsThe arguments passed to the executable when the service starts.
stopargumentsThe arguments passed to the executable when the service stops.

Service Log Files

When running as a Windows service, the runtime console output is instead written to two files in runtime\service\logs:

FileContents
service-installer-windows.out.logEverything the runtime wrote to standard output.
service-installer-windows.err.logEverything the runtime wrote to standard error.

These files are useful when the service fails to start, because a startup failure often occurs before the Intelligence Hub is able to log anything itself.

Each file is rotated independently. When a file is rotated, the current file is renamed to service-installer-windows.0.out.log, any existing archive is shifted up by one, and the oldest archive is deleted.

Log Rotation Modes

The logmode element determines whether the service log files are bounded. Because the Intelligence Hub typically runs for months without a restart, a mode that only rotates at startup will allow a log file to grow indefinitely. A pipeline that repeatedly logs the same error can produce a very large file this way.

The mode can be written in either of two equivalent forms. The shipped configuration uses a logmode element that holds the mode name as its text, such as <logmode>roll-by-size</logmode>. The alternative is a log element that carries the mode name in a mode attribute instead, such as <log mode="roll-by-size">. The log form is required when changing the size limits described in Changing the Log Size Limit , because that form is the only one that accepts nested elements.

ModeBehaviorBounds the active file for a long-running service?
roll-by-sizeChecks the file size as each line is written and rotates during operation.Yes
roll-by-timeRotates on a time pattern, such as daily. Requires a pattern element.Yes
roll-by-size-timeRotates on size or on a time pattern, whichever comes first. Requires a pattern element.Yes
rollRenames the file when the service starts, then appends to a new file.No
resetTruncates the file when the service starts, then appends to it.No
appendAppends to the file indefinitely and never rotates.No
noneDiscards the output. No file is written.Yes

Bounding the active file is not the same as bounding total disk usage. Of the rotating modes, only roll-by-size also limits how many archives are kept, as described in Changing the Log Size Limit .

Changing the Log Size Limit

The rotation limits are set by two elements:

ElementDescription
sizeThresholdThe size in kilobytes a file may reach before it is rotated. Defaults to 10240, which is 10 MB.
keepFilesThe number of archives to retain, in addition to the file currently being written. Defaults to 8. Applies to roll-by-size only.

Both elements must be nested inside a log element, so setting them requires switching from the logmode form to the log form. Remove the logmode line and add the following in its place, noting that the mode name moves into a mode attribute. The example below rotates each file at 5 MB and keeps two archives, limiting each set of files to roughly 15 MB.

<log mode="roll-by-size">
  <sizeThreshold>5120</sizeThreshold>
  <keepFiles>2</keepFiles>
</log>

Both values must be given as plain numbers. Unlike logpath, they do not accept environment variables, and a value that is not a number will prevent the service from starting.

If the mode is changed to roll-by-time or roll-by-size-time, keepFiles no longer has any effect, and neither mode prunes archives on its own:

  • roll-by-time retains every archive it creates, and offers no element that removes or compresses them. The number of archives grows for as long as the service runs.
  • roll-by-size-time accepts a zipOlderThanNumDays element, which compresses archives older than the given number of days and deletes the originals. It takes effect only when an autoRollAtTime element is also present, because the compression runs on that daily schedule. The resulting zip files are grouped by zipDateFormat, which defaults to one file per month, and are never removed.

Restart the HighByte Intelligence Hub Runtime service to apply the change.

Upgrades

The configuration file is part of the runtime directory, so the upgrade process replaces it with a fresh copy. Note any changes you make so they can be applied again to the new installation.

Linux

Copy the runtime, configuration, and appData directories from HighByte-Intelligence-Hub-x.x to the desired installation directory, using sudo if the location requires super user permission. This example will use /opt/highbyte.

Once complete, the directory listing should look like:

$ ls /opt/highbyte/
configuration  runtime appData

Make sure the start and stop scripts have execute permissions: sudo chmod +x /opt/highbyte/runtime/*-linux.sh

Using sudo, create /etc/systemd/system/highbyte.service. This minimal example service file will automatically start the Intelligence Hub during system boot-up.

To install the service run: sudo systemctl enable highbyte.service

To start the service run: sudo systemctl start highbyte.service

To verify the service started successfully run: sudo systemctl status highbyte.service

Console Output

A systemd service directs the console output of the runtime according to the StandardOutput and StandardError settings in the service file. When these settings are left at their defaults, the output is sent to the journal and is viewed by running journalctl -u highbyte.service. The journal applies its own size limits, which are configured in /etc/systemd/journald.conf rather than by the Intelligence Hub.

If the service file redirects this output to a file instead, that file will grow without limit unless an external log rotation tool such as logrotate is configured to bound it.