Skip to content

cmem_client.models.logs¤

Corporate Memory log buffer models.

Models for the in-memory log buffer API of a Corporate Memory service (GET /api/admin/logs and GET /api/admin/logs/status). Each instance of a service keeps its own buffer and answers only with its own lines, which is why the responses carry an instance identifier and a per instance sequence number.

Classes:

  • LogBufferStatus – State and configuration of the in-memory log buffer of one instance.
  • LogLevel – Log level a line can be requested at, ordered from least to most severe.
  • LogLine – A single buffered log line.
  • LogTailResponse – The most recent buffered log lines of one instance, with the state of that read.

LogBufferStatus¤

Bases: Model

State and configuration of the in-memory log buffer of one instance.

Attributes:

  • enabled (bool) – Whether the buffer is enabled in this deployment.
  • attached (bool) – Whether the buffer is attached to the logging framework and therefore actually capturing.
  • capture_level (str | None) – The minimum level which is captured, regardless of the configured logging levels.
  • capacity (int) – How many lines the buffer holds before the oldest ones are discarded.
  • max_message_chars (int) – Length a message is truncated to before it is buffered.
  • size (int) – How many lines are buffered at the moment.
  • first_sequence (int) – Oldest sequence still buffered.
  • last_sequence (int) – Highest sequence buffered.
  • instance_id (str) – The instance this status describes.
  • excluded_loggers (list[str]) – Loggers which are never captured, because they carry user data or credentials.
  • non_additive_loggers (list[str]) – Loggers which do not propagate to the buffer through their parent.
  • request_id_mdc_key (str | None) – The mapped diagnostic context key the correlation identifier is taken from.

attached¤

attached: bool

capacity¤

capacity: int

capture_level¤

capture_level: str | None = Field(alias='captureLevel', default=None)

enabled¤

enabled: bool

excluded_loggers¤

excluded_loggers: list[str] = Field(alias='excludedLoggers', default_factory=list)

first_sequence¤

first_sequence: int = Field(alias='firstSequence')

instance_id¤

instance_id: str = Field(alias='instanceId')

last_sequence¤

last_sequence: int = Field(alias='lastSequence')

max_message_chars¤

max_message_chars: int = Field(alias='maxMessageChars')

model_config¤

model_config = ConfigDict(extra='allow', populate_by_name=True)

non_additive_loggers¤

non_additive_loggers: list[str] = Field(alias='nonAdditiveLoggers', default_factory=list)

request_id_mdc_key¤

request_id_mdc_key: str | None = Field(alias='requestIdMdcKey', default=None)

size¤

size: int

LogLevel¤

Bases: StrEnum

Log level a line can be requested at, ordered from least to most severe.

The level of a request is a minimum: asking for WARN returns the lines logged at WARN as well as the ones logged at ERROR.

Attributes:

DEBUG¤

DEBUG = 'DEBUG'

ERROR¤

ERROR = 'ERROR'

INFO¤

INFO = 'INFO'

TRACE¤

TRACE = 'TRACE'

WARN¤

WARN = 'WARN'

LogLine¤

Bases: Model

A single buffered log line.

Attributes:

  • sequence (int) – Position of this line in the log stream of the answering instance.
  • timestamp (datetime) – When the line was logged.
  • level (str) – Level the line was logged at. Not restricted to LogLevel, because a service may log at a level which cannot be requested.
  • logger (str) – Name of the logger which produced the line.
  • thread (str | None) – Thread the line was logged on, if the service reported one.
  • message (str) – The log message.
  • throwable (str | None) – The rendered exception, if the line carried one.
  • request_id (str | None) – Correlation identifier of the request which produced this line. The same value is returned in the X-Request-Id header and, for a failed request, in its problem detail. Lines logged off the request thread carry none.

level¤

level: str

logger¤

logger: str

message¤

message: str

model_config¤

model_config = ConfigDict(extra='allow', populate_by_name=True)

request_id¤

request_id: str | None = Field(alias='requestId', default=None)

sequence¤

sequence: int

thread¤

thread: str | None = None

throwable¤

throwable: str | None = None

timestamp¤

timestamp: datetime

LogTailResponse¤

Bases: Model

The most recent buffered log lines of one instance, with the state of that read.

Attributes:

  • server_time (int) – Epoch milliseconds the response was assembled at.
  • instance_id (str) – The instance which answered. Sequence numbers are only meaningful together with this value.
  • first_sequence (int) – Oldest sequence still buffered.
  • last_sequence (int) – Highest sequence examined. Pass it as the since of the next request to receive only what has been logged in between.
  • truncated (bool) – Whether the limit cut the result short.
  • dropped (int) – How many lines were lost between the requested since and what the buffer still holds.
  • lines (list[LogLine]) – The matching lines, oldest first.

dropped¤

dropped: int = 0

first_sequence¤

first_sequence: int = Field(alias='firstSequence')

instance_id¤

instance_id: str = Field(alias='instanceId')

last_sequence¤

last_sequence: int = Field(alias='lastSequence')

lines¤

lines: list[LogLine] = Field(default_factory=list)

model_config¤

model_config = ConfigDict(extra='allow', populate_by_name=True)

server_time¤

server_time: int = Field(alias='serverTime')

truncated¤

truncated: bool = False

Comments