sentry-logger-set-time-range

Sets the allowed operating time range for a remote sentry logger.

Command properties

PropertyDescription
Command typeTransforming
Required permissionAdministrator
License usageN/A
Parallel executionSupported
Distributed executionNot supported

Syntax

sentry-logger-set-time-range [timeout=INT]

Options

timeout=INT
RPC timeout in seconds. Accepts a value between 1 and 600. (Default: 30)

Input fields

FieldTypeRequiredDescription
guidstringRequiredSentry unique identifier.
namestringRequiredLogger name.
start_timestringOptionalCollection start time (format: HH:mm). Must be specified together with end_time.
end_timestringOptionalCollection end time (format: HH:mm). Must be specified together with start_time.

Output fields

FieldTypeDescription
_errorstringError message added to the original record if an error occurs.

Error codes

Parsing errors
Error codeMessageDescription
23100No permission to call sentry RPC.A user without administrator privileges ran the command.
23101Invalid sentry RPC timeout option value. Use a value between 1 and 600.The timeout option value is not an integer or is outside the range 1–600.
Runtime errors

Errors are returned via the _error field:

Error messageDescription
guid is nullThe guid field value in the input record is null.
guid should be stringThe guid field value in the input record is not a string.
guid should be non empty stringThe guid field value in the input record is an empty string.
name should be not nullThe name field value in the input record is null.
name should be stringThe name field value in the input record is not a string.
name should be non empty stringThe name field value in the input record is an empty string.
invalid start_time formatThe start_time field value is not a valid HH:mm format.
invalid end_time formatThe end_time field value is not a valid HH:mm format.
start_time is not null but end_time is nullstart_time is specified but end_time is null.
end_time is not null but start_time is nullend_time is specified but start_time is null.
not connectedThe sentry is not connected.
timeoutThe RPC request timed out.
disconnectedThe connection was lost while processing the RPC request.

Other RPC exception messages may be returned depending on the state of the system where the sentry is installed.

Description

The sentry-logger-set-time-range command reads the guid, name, start_time, and end_time fields from input records and sets the allowed operating time range for the corresponding sentry logger by sending an asynchronous RPC message.

If both start_time and end_time field values are null, the existing allowed time range setting for the target logger is removed. If only one is null and the other is not, an error occurs.

Time values must be 5-character strings in HH:mm format. The hour must be in the range 0–24 and the minute must be in the range 0–60.

This command returns results in the order RPC response messages are received from sentries, so the output record order may differ from the input record order.

Examples

  1. Set the allowed operating time range for a specific logger

    sentry
    | sentry-loggers
    | search name == "weblog"
    | eval start_time = "22:00", end_time = "06:00"
    | sentry-logger-set-time-range
    

    Configures the weblog logger on all sentries to collect only between 10:00 PM and 6:00 AM.

  2. Remove the allowed time range setting

    sentry
    | sentry-loggers
    | search name == "weblog"
    | eval start_time = null, end_time = null
    | sentry-logger-set-time-range
    

    Removes the allowed time range setting for the weblog logger on all sentries so that it always collects.