sentry-logger-set-time-range

Updates the logging time range of a specific sentry logger.

Syntax

sentry-logger-set-time-range [timeout=INT]
Parameter
timeout=INT
RPC timeout in seconds (default: 30 seconds)

Description

This query command sends asynchronous RPC request messages to 100 sentries at the same time and waits for responses.The RPC request message queue operates on a first-in, first-out (FIFO) basis. For example, if the Logpresso server needs to send RPC messages to 150 sentries, the server sends an RPC message to 100 sentries first and waits until RPC responses. If the waiting time exceeds the time specified in the timeout (default: 30 seconds), it is considered that an error has occurred on the sentry side. If 32 out of 100 sentries respond or timeout is exceeded, the Logpresso server sends an RPC message to the additional 32 sentries.

The query command outputs the results of RPC response messages in the order they are received. Depending on the load or network conditions of the host where Sentry is installed, the order of the responses may vary with each execution. Use the output data but do not rely on the order of the records.

Tip
Logpresso environment variable `logpresso.core.sentry_rpc_parallel` determines the length of the asynchronous RPC request message queue. The default value is `100` and you can adjust the length by modifying the value of this environment variable.
Input Field

This query requires that the input record contains guid, name, start_time and end_time field values.

FieldTypeRequiredDescription
guidStringOUnique sentry identifier (Not relevant to GUID in JAVA)
nameStringOUnique logger identifier in the sentry namespace
start_timeStringXLogging start time (Format: HH:mm)
end_timeStringXLogging end time (Format: HH:mm)

You can remove the existing time range setting by providing null to both start_time and end_time fields.

Output Fields

If any error occurs, this query command returns an _error field in addition to the fields from input record. Possible errors are as follows:llows:llows:

Error MessageDescription
guid is nullguid field value from input record is null.
guid should be stringguid field value from input record is not a string.
guid should be non empty stringguid field value from input record is empty.
name should be not nullname field value from input record is null.
name should be stringname field value from input record is not a string.
name should be non empty stringname field value from input record is empty.
invalid start_time formatstart_time field value from input record is not in valid format (HH:mm).
invalid end_time formatend_time field value from input record is not in valid format (HH:mm).
start_time is not null but end_time is nullend_time field value is missing. start_time field value is set.
end_time is not null but start_time is nullstart_time field value is missing. end_timefield value is set.
logger not found: nameLogger of the specified name (name) is not found.
timeoutRPC request timeout exceeded
disconnectedDisconnected while processing RPC request
not connectedSentry is not connected.

Depending on the system where the sentry is installed, an RPC exception message other than the above can be issued.

Usage

  1. Set 'weblog' loggers of all connected sentries to run from 10:00 PM to 06:00 AM only.

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