Skip to main content
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

Metadata

Release files for flask-graylog-bundle 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-graylog-bundle 0.1.3
File Size Uploaded Provenance
flask-graylog-bundle-0.1.3.tar.gz 5.3 kB Without provenance Details

Release files / flask-graylog-bundle-0.1.3.tar.gz

Download URL flask-graylog-bundle-0.1.3.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d90d467f28699dfb3efa06d874e97a0cd850acd3c69b933796e9fc346453c3b6
BLAKE2b-256 checksum
How to use checksums
ab76f46cd0f75c0739cf8017b685d43db2836ec5d27abed90b2ebe7d554bd2f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.6

Security for flask-graylog-bundle 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page