Table of Contents
View logs.
Usage
s9s log {command} {options}
Command
Name, shorthand | Description |
---|---|
−−list , -L |
Lists all log entries. |
Options
Name, shorthand | Description |
---|---|
CLUSTER RELATED OPTIONS | |
−−cluster-id=ID |
The ID of the cluster to check. |
−−cluster-name=NAME |
The NAME of the cluster to check. |
JOB RELATED OPTIONS | |
--limit=NUMBER |
Limits the number of log messages printed. |
−−message-id=ID |
The numerical ID for the message to list. When this command line option is provided there will be at most one message processed. |
−−offset=NUMBER |
Controls the relative index of the first item printed. |
−−log-format=FORMATSTRING |
The string that controls the format of the printed log and job messages. See Log Format Variables. |
Log Format Variables
Controls the format of the messages as they are printed. This command line option has the same effect as the brief_log_format
and long_log_format
configuration variables.
The format string uses the %
character to mark variable fields, and flag characters as they are specified in the standard printf()
C library functions and its own field name letters to refer to the various properties of the messages.
The %+12I
format string for example has the +12
flag characters in it with the standard meaning: the field will be 12 characters wide and the +
or -
sign will always be printed with the number. Standard \
notation is also available, \n for example encodes a new-line character.
The properties of the message are encoded by letters. The in the %-5L
for example the letter L
encodes the “line-number” field, so the number of the source line that produced the message will be substituted. The program supports the following fields:
Variable | Description |
---|---|
A | The message text as ASCII string (no syntax highlight using terminal escape sequences). |
B | The basename of the source file that produced the message. |
c | A short keyword that can be used to classify the log messages without parsing the message text and trying to recognize its meaning. |
C | The creation timestamp of the log message. |
h | The hostname of the host which is related to the log message. Please note that not all log entries are related to one specific host. |
i | The cluster ID. If the log message is not related to any clusters the ID here will be 0. |
I | The ID of the message is a numerical ID that can be used as a unique identifier for the message. |
j | The entire message object as a JSon string. |
L | The line number in the source file where the message was created. This property is implemented mostly for debugging purposes. |
M | The message text without colors. |
m | The message text uses ANSI color sequences where applicable. |
M | The message text. |
o | The name of the component (subsystem) that sent the log message. This field can further classify the messages by their meaning without parsing the text itself. |
P | The port of the host if the message is directly related to one specific service on one specific host. |
s | The severity of the message using one of the “Ok”, “Warning”, or “Critical” strings. |
S | The severity of the message in text format. This field can be “MESSAGE”, “WARNING” or “FAILURE”. |
T | The creation time of the message. This is similar to the C field but shows only hours, minutes, and seconds instead of the full date and time. |
z | The creation date and time in ISO 8601 format (e.g. “2019-08-26T09:11:05.906Z”) without the time one. |
Z | The creation date and time in ISO 8601 format (e.g. “2019-08-26T11:11:44.912-01:00”) in the controller server’s own time. |
% | The % character itself. |
Examples
List log messages for Cluster ID 1:
$ s9s log \
--list \
--cluster-id=1
List log messages for Cluster ID 1 except the 10 last log records:
$ s9s log \
--list \
--cluster-id=1 \
--offset=10
List only the last 20 log messages for Cluster ID 1:
$ s9s log \
--list \
--cluster-id=1 \
--limit=20
List 20 log messages skipping the latest 20 log records for Cluster ID 1:
$ s9s log \
--list \
--cluster-id=1 \
--limit=20 \
--offset=20
Print a log message that is about a Cmon Job being started. It prints some information with the %
notation and the job JSon string that is part of the log entry
$ s9s log \ --list \ --message-id=23 \ --log-format=' ID: %I\nclass: %c\n loc: %B:%L\n mess: %M\n job:\n${/log_specifics/job_instance/job_spec}\n'$ s9s job --disable --job-id=102 ID: 23 class: JobStarted loc: CmonCommandHandlerWorker.cpp:332 mess: Job 'Create Cluster' just started. job: { "command": "create_cluster", "job_data": { "cluster_name": "ft_postgresql_8488", "cluster_type": "postgresql_single", "enable_uninstall": true, "install_software": true, "nodes": [ { "class_name": "CmonHost", "hostname": "192.168.0.76", "port": 8089 } ], "postgre_user": "postmaster", "ssh_user": "pipas", "sudo_password": "", "type": "postgresql", "version": "10" } }