Bases: object
Publishes log data to Kafka
LogPublisher is able to send single message to multiple configured topic. It uses following configuration written in conf file
[log_publisher]
topics = 'logs'
kafka_url = 'localhost:8900'
Bases: dict
Creates new log envelope
Log envelope is combined ouf of following properties
Example output json would like this:
{
    "log": {
      "message": "Some message",
      "dimensions": {
        "hostname": "devstack"
      }
    },
    "creation_time": 1447834886,
    "meta": {
      "tenantId": "e4bd29509eda473092d32aadfee3e7b1",
      "region": "pl"
    }
}
| Parameters: | 
 | 
|---|
Application type constraint used in validation.
See Validations.validate_application_type()
Constraint for name of single dimension.
See Validations.validate_dimensions()
Constraint for value of single dimension.
See Validations.validate_dimensions()
Validates application type.
Validation won’t take place if application_type is None. For details see: APPLICATION_TYPE_CONSTRAINTS
| Parameters: | application_type (str) – application type | 
|---|
Validates content type.
Method validates request against correct content type.
If content-type cannot be established (i.e. header is missing), falcon.HTTPMissingHeader is thrown. If content-type is not application/json or text/plain, falcon.HTTPUnsupportedMediaType is thrown.
| Parameters: | 
 | 
|---|---|
| Exception: | falcon.HTTPMissingHeader | 
| Exception: | falcon.HTTPUnsupportedMediaType | 
Validates dimensions type.
Empty dimensions are not being validated. For details see:
| Parameters: | dimensions (dict) – dimensions to validate | 
|---|
Validates log property.
Log property should have message property.
Validates payload size.
Method validates sent payload size. It expects that http header Content-Length is present. If it does not, method raises falcon.HTTPLengthRequired. Otherwise values is being compared with
[service]
max_log_size = 1048576
max_log_size refers to the maximum allowed content length. If it is exceeded falcon.HTTPRequestEntityTooLarge is thrown.
| Parameters: | req (falcon.Request) – current request | 
|---|---|
| Exception: | falcon.HTTPLengthRequired | 
| Exception: | falcon.HTTPRequestEntityTooLarge |