cterasdk.core.logs module#

class cterasdk.core.logs.Alerts(core)#

Bases: BaseCommand

Portal Log Based Alerts APIs

add(name, description=None, topic=None, log=None, min_severity=None, origin_type=None, content=None)#

Add a Log Based Alert

Parameters:
  • name (str) – Alert name

  • description (str,optional) – Alert description

  • topic (cterasdk.core.enum.LogTopic,optional) – Log topic to get, defaults to any topic

  • log (str,optional) – Class name of the log

  • min_severity (cterasdk.core.enum.Severity,optional) – Minimun severity for triggering an alert, defaults to any severity

  • origin_type (cterasdk.core.enum.OriginType,optional) – Origin type of the log, defaults to any origin

  • content (str) – Content of the log message

Returns:

A list of alerts

Return type:

list[cterasdk.common.object.Object]

delete(name)#

Remove a Log Based Alert

Parameters:

name (str) – Alert name

get()#

Get a List of Log Based Alerts

Returns:

A list of alerts

Return type:

list[cterasdk.common.object.Object]

put(alerts)#
Set Log Based Alerts

Use cterasdk.core.types.AlertBuilder() to build log based alerts

Parameters:

alerts (list[cterasdk.core.types.Alert]) – List of alerts

class cterasdk.core.logs.Logs(portal)#

Bases: BaseCommand

Portal Logs APIs

Variables:

alerts (cterasdk.core.logs.Alerts) – Object holding the Portal Log Based Alerts APIs

device(name, topic='system', min_severity='info', before=None, after=None, filters=None)#

Get device logs from the Portal

Parameters:
  • name (str) – Name of a device

  • topic (cterasdk.core.enum.LogTopic,optional) – Log topic to get, defaults to cterasdk.core.enum.LogTopic.System

  • min_severity (cterasdk.core.enum.Severity,optional) – Minimun severity of logs to get, defaults to cterasdk.core.enum.Severity.INFO

  • before (str,optional) – Get logs before this date (in format “%m/%d/%Y %H:%M:%S”), defaults to None

  • after (str,optional) – Get logs after this date (in format “%m/%d/%Y %H:%M:%S”), defaults to None

  • filters (list[cterasdk.core.query.FilterBuilder],optional) – List of additional filters, defaults to None

Returns:

Iterator for all matching logs

Return type:

cterasdk.lib.iterator.Iterator[cterasdk.object.Object]

get(topic='system', min_severity='info', origin_type='Portal', origin=None, before=None, after=None, filters=None)#

Get logs from the Portal

Parameters:
  • topic (cterasdk.core.enum.LogTopic,optional) – Log topic to get, defaults to cterasdk.core.enum.LogTopic.System

  • min_severity (cterasdk.core.enum.Severity,optional) – Minimun severity of logs to get, defaults to cterasdk.core.enum.Severity.INFO

  • origin_type (cterasdk.core.enum.OriginType,optional) – Origin type of the logs to get, defaults to cterasdk.core.enum.OriginType.Portal

  • origin (str,optional) – Log origin (e.g. device name, Portal server name), defaults to None

  • before (str,optional) – Get logs before this date (in format “%m/%d/%Y %H:%M:%S”), defaults to None

  • after (str,optional) – Get logs after this date (in format “%m/%d/%Y %H:%M:%S”), defaults to None

  • filters (list[cterasdk.core.query.FilterBuilder],optional) – List of additional filters, defaults to None

Returns:

Iterator for all matching logs

Return type:

cterasdk.lib.iterator.Iterator[cterasdk.object.Object]