Skip to main content

Output syslog of the json format.

Project description

Downloads Supported Python versions Latest Version License

This is the Flask extension facility to output syslog of the Json form.

Installation

pip install flask-json-syslog

Example

config.py

JSON_SYSLOG_LEVEL = 'info'# Log level
JSON_SYSLOG_NUMBER = 168  # syslog.LOG_LOCAL5
JSON_SYSLOG_FACILITY = 6  # syslog.LOG_INFO

app.py

from flask import g
from flask_json_syslog import FlaskJsonSyslog

app = Flask(__name__)
flask_json_syslog = FlaskJsonSyslog(app)

...

@app.before_request
def before_request():
    g.json_log = flask_json_syslog.put

In your application

g.json_log({'foo': 'bar'}, ...)

(r)syslog.conf

...

$template json,"%msg%\n"
local5.* /var/log/local5.log;json

...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-Json-Syslog-0.1.28.tar.gz (2.5 kB view hashes)

Uploaded source

Built Distributions

Flask_Json_Syslog-0.1.28-py2.7.egg (4.2 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page