Skip to main content

Flask Graylog client

Project description

https://travis-ci.org/cdumay/flask-graylog-bundle.svg?branch=master

flask-graylog-bundle

Graylog extension for Flask

Quickstart

First, install flask-graylog-bundle using pip:

pip install flask-graylog-bundle

Auth extension

To enable Graylog auth, add a GraylogAuth instance to your code:

from flask import current_app as app
from flask_graylog_bundle.auth import GraylogAuth

app.config.update({
   "GRAYLOG_API_URL": "http://127.0.0.1:12900"
})

auth = GraylogAuth(app)

You can take a look at examples/auth.py for more complete example. Flask’s application factories and blueprints.

It provides a login decorator login_required. To use it just wrap a view function:

@app.route('/secret-page')
@auth.login_required
def secret_page():
    return jsonify({
        "message": "hello",
        "username": auth.username
    })

Additionnal info can be accessed using g.user (see: Graylog REST API result of GET /users/{username})

NOTE: Graylog tokens are supported, take a look at the Graylog REST API documentation.

API client

To use query Graylog API, add a GraylogAPIServer instance to your code:

from flask import Flask
from flask_graylog_bundle.server import GraylogAPIServer

app = Flask(__name__)
app.config.update({
    "GRAYLOG_API_URL": "http://127.0.0.1:12900",
    "GRAYLOG_API_USERNAME": "admin",
    "GRAYLOG_API_PASSWORD": "admin"
})

api = GraylogAPIServer(app)

You can take a look at examples/api.py for a complete example.

License

Apache License 2.0

Project details


Release history Release notifications

This version
History Node

0.1.0

History Node

0.0.11

History Node

0.0.10

History Node

0.0.9

History Node

0.0.7

History Node

0.0.6

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
flask-graylog-bundle-0.1.0.tar.gz (5.1 kB) Copy SHA256 hash SHA256 Source None Mar 14, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page