sentry-logger-set-schedule
Changes the cron-format collection schedule of a remote sentry logger.
Command properties
| Property | Description |
|---|---|
| Command type | Transforming |
| Required permission | Administrator |
| License usage | N/A |
| Parallel execution | Supported |
| Distributed execution | Not supported |
Syntax
Options
timeout=INT- RPC timeout in seconds. Accepts a value between 1 and 600. (Default:
30)
Input fields
| Field | Type | Required | Description |
|---|---|---|---|
guid | string | Required | Sentry unique identifier. |
name | string | Required | Logger name. |
cron_schedule | string | Optional | Cron-format collection schedule. If null, the existing schedule is deleted. |
The cron_schedule field uses the same format as cron on Unix-like operating systems. Specify 5 fields in the order: minute, hour, day, month, and day of week.
Output fields
| Field | Type | Description |
|---|---|---|
_error | string | Error message added to the original record if an error occurs. |
Possible values for the _error field:
| Error message | Description |
|---|---|
| guid is null | The guid field value in the input record is null. |
| guid should be string | The guid field value in the input record is not a string. |
| guid should be non empty string | The guid field value in the input record is an empty string. |
| name should be not null | The name field value in the input record is null. |
| name should be string | The name field value in the input record is not a string. |
| name should be non empty string | The name field value in the input record is an empty string. |
| cron_schedule should be string | The cron_schedule field value in the input record is not a string. |
| wrong cron expression format: EXPR | The cron_schedule field value is not a valid cron expression. |
| not connected | The specified sentry is not connected. |
| timeout | The RPC request timed out. |
| disconnected | The connection was lost while processing the RPC request. |
Other RPC error messages may be returned depending on the state of the system where the sentry is installed.
Error codes
Parsing errors
| Error code | Message | Description |
|---|---|---|
| 23100 | No permission to call sentry RPC. | The user does not have administrator privileges. |
| 23101 | Invalid sentry RPC timeout option value. Use a value between 1 and 600. | The timeout value is outside the range 1–600 or is not a number. |
Runtime errors
N/A
Description
The sentry-logger-set-schedule command identifies a sentry by the guid field of the input record and a logger by the name field, then changes the collection schedule to the cron-format schedule specified in the cron_schedule field by sending an asynchronous RPC message to the sentry. If the cron_schedule field is null, the existing collection schedule is deleted.
The maximum length of the asynchronous RPC request queue is 100 by default and can be adjusted using the logpresso.core.sentry_rpc_parallel environment variable. When the queue is full, new requests wait until existing requests complete or time out.
Results are output in the order RPC responses are received from sentries, so the output record order may differ from the input record order.
Examples
-
Set a specific logger on all sentries to run at the top of every hour
system sentries | sentry-loggers | search name == "wtmp_linux" | eval cron_schedule = "0 * * * *" | sentry-logger-set-scheduleChanges the collection schedule of the
wtmp_linuxlogger to run at minute 0 of every hour on all connected sentries. -
Delete the collection schedule
system sentries | sentry-loggers | search name == "wtmp_linux" | eval cron_schedule = null | sentry-logger-set-scheduleDeletes the cron-format collection schedule of the
wtmp_linuxlogger on all connected sentries. -
Change the collection schedule with a specified timeout
system sentries | sentry-loggers | search name == "syslog_linux" | eval cron_schedule = "*/5 * * * *" | sentry-logger-set-schedule timeout=120Changes the collection schedule of the
syslog_linuxlogger to run every 5 minutes with the RPC timeout set to 120 seconds.