Applications

Authentication

class logsight.authentication.LogsightAuthentication(email, password)

Bases: APIClient

__init__(email, password)

Class to authenticate users.

Parameters
  • email (str) – Email associated with the subscription.

  • password (str) – Password key associated with the subscription.

property token

Gets a token.

Returns

Access token

Return type

token (str)

property user_id

Gets the user id.

Returns

Identifier of the user

Return type

user_id (str)

Compare

class logsight.compare.LogsightCompare(token)

Bases: APIClient

__init__(token)

Class to compare logs.

Parameters

token (str) – Access token.

compare(baseline_tags, candidate_tags, log_receipt_id=None)

Compares the logs on an application.

Parameters
  • baseline_tags (dict) – Tags of the baseline logs.

  • candidate_tags (dict) – Tags of the candidate logs.

Returns

dict.
{

“addedStatesFaultPercentage”: 0, “addedStatesReportPercentage”: 0, “addedStatesTotalCount”: 0, “baselineLogCount”: 0, “baselineTags”: {

”additionalProp1”: “string”, “additionalProp2”: “string”, “additionalProp3”: “string”

}, “candidateChangePercentage”: 0, “candidateLogCount”: 0, “candidateTags”: {

”additionalProp1”: “string”, “additionalProp2”: “string”, “additionalProp3”: “string”

}, “compareId”: “string”, “deletedStatesFaultPercentage”: 0, “deletedStatesReportPercentage”: 0, “deletedStatesTotalCount”: 0, “frequencyChangeFaultPercentage”: {}, “frequencyChangeReportPercentage”: {}, “frequencyChangeTotalCount”: 0, “link”: “string”, “recurringStatesFaultPercentage”: 0, “recurringStatesReportPercentage”: 0, “recurringStatesTotalCount”: 0, “risk”: 0, “totalLogCount”: 0

}

Raises
  • BadRequest – if the app_name is invalid, it is duplicated, or too the maximum number of applications has been reached

  • Unauthorized – If the private_key is invalid.

get_comparison_id(comp_id)

Get comparison with id comp_id.

Parameters

comp_id (string) – Comparison Id.

Returns

dict.
{
“listCompare”: [
{

“_id”: “string”, “_source”: {}

}

]

}

ls_comparisons()

List comparisons stored.

Returns

dict.
{
“listCompare”: [
{

“_id”: “string”, “_source”: {

”baseline_tags”: {

“additionalProp1”: “string”, “additionalProp2”: “string”, “additionalProp3”: “string”

}, “candidate_tags”: {

”additionalProp1”: “string”, “additionalProp2”: “string”, “additionalProp3”: “string”

}, “risk”: 0, “severity”: 0, “status”: 0, “timestamp”: “string”

}

}

]

}

rm_comparison_id(comp_id)

Remove comparison with id comp_id.

Parameters

comp_id (string) – Comparison Id.

Returns

dict.
{

“compareId”: “string”

}

set_status(comp_id, status)

Set the status of a comparison with id comp_id.

Parameters
  • comp_id (string) – Comparison Id.

  • status (int) – Comparison status.

Returns

dict.
{

“compareId”: “string”

}

Logger

Logs

Users

class logsight.users.LogsightUsers

Bases: APIClient

__init__()

Class to manage users.

create(email, password)

Creates a new user.

Parameters
  • email (str) – Email associated with the subscription.

  • password (str) – Password key associated with the subscription.

Returns

Identifier for the user created

Return type

userId (str)

delete(user_id, token)

Deletes a new user.

Parameters

userId (str) – Identifier for the user

Exceptions

exception logsight.exceptions.APIException(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict)

Bases: Exception

__init__(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict) None

Problem exception as defined in RFC 7807 (https://tools.ietf.org/html/rfc7807).

Parameters
  • status – HTTP status code generated by the remote server.

  • title – Short, human-readable title for the general error type; the title should not change for given types.

  • detail – Human-readable description of the specific error.

  • type – URL to a document describing the error condition (optional, and “about:blank” is assumed if none is provided; should resolve to a human-readable document).

  • instance – This optional key may be present, with a unique URI for the specific error; this will often point to an error log for that specific response.

  • **kwargs – additional context information

exception logsight.exceptions.BadGateway(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict)

Bases: APIException

message = 'the server, while acting as a gateway or proxy,\n    received an invalid response from the upstream server.'
status_code = 502
exception logsight.exceptions.BadRequest(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict)

Bases: APIException

message = 'BadRequest: the server cannot or will not\n    process the request  due to something that is perceived\n    to be a client error.'
status_code = 400
exception logsight.exceptions.Conflict(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict)

Bases: APIException

message = 'Conflict: a request conflict with current state\n    of the target resource.'
status_code = 409
exception logsight.exceptions.DataCorruption(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict)

Bases: APIException

message = 'DataCorruption: the client was unable to parse a\n    data structured received from the server.'
exception logsight.exceptions.Forbidden(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict)

Bases: APIException

message = 'Forbidden: the server understands the request\n    but refuses to authorize it.'
status_code = 403
exception logsight.exceptions.InternalServerError(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict)

Bases: APIException

message = 'InternalServerError: the server has encountered\n    a situation it does not know how to hand.'
status_code = 500
exception logsight.exceptions.LogsightException(message=None, **kwargs)

Bases: Exception

Base Logsight Exception

__init__(message=None, **kwargs)
message = 'An unknown exception occurred.'
exception logsight.exceptions.NotFound(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict)

Bases: APIException

message = "NotFound: the server can't find the requested\n    resource."
status_code = 404
exception logsight.exceptions.ServiceUnavailable(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict)

Bases: APIException

message = 'ServiceUnavailable: the server is not ready to\n    handle the request.'
status_code = 503
exception logsight.exceptions.Unauthorized(type_: Optional[str] = None, title: Optional[str] = None, status: Optional[int] = None, detail: Optional[str] = None, message: Optional[str] = None, instance: Optional[str] = None, **kwargs: Dict)

Bases: APIException

message = 'Unauthorized: the request has not been applied\n    because it lacks valid authentication credentials for the\n    target resource.'
status_code = 401
logsight.exceptions.from_dict(data: Dict[str, Any]) APIException

Create a new APIException instance from a dictionary.

This uses the dictionary as keyword arguments for the APIException constructor. If the given dictionary does not contain any fields matching those defined in the RFC7807 spec, it will use defaults where appropriate (e.g. status code 500) and use the dictionary members as supplemental context in the response.

Parameters

data – The dictionary to convert into an APIException exception.

Returns

A new APIException instance populated from the dictionary fields.