NetBox plugin to display Graylog logs in device and VM detail pages
Project description
NetBox Graylog Plugin
A NetBox plugin that displays recent Graylog logs in Device and VirtualMachine detail pages.
Features
- Logs Tab: Adds a "Logs" tab to Device and VirtualMachine detail pages
- Time Range Selection: Quick buttons for 5m, 15m, 1h, 4h, 24h, and 7d time ranges
- Smart Search: Searches by hostname first, falls back to primary IP if no results
- Caching: Caches API responses to reduce load on Graylog
- Error Handling: Graceful degradation when Graylog is unavailable
Screenshots
Settings Page
Configure Graylog connection settings directly in the NetBox UI.
Logs Tab
View Graylog logs directly on Device and VirtualMachine pages.
Requirements
- NetBox 4.0 or higher (tested on NetBox 4.x only)
- Graylog 4.0 or higher with API access
- Python 3.10+
Note: This plugin is developed and tested exclusively on NetBox 4.x. It is not compatible with NetBox 3.x due to API and model changes.
Installation
From PyPI (when published)
pip install netbox-graylog
From Source
git clone https://github.com/sieteunoseis/netbox-graylog.git
cd netbox-graylog
pip install -e .
Docker Installation
Add to your NetBox Docker requirements file:
# requirements-extra.txt
netbox-graylog
Or for development:
# In docker-compose.override.yml, mount the plugin:
volumes:
- /path/to/netbox-graylog:/opt/netbox/netbox/netbox_graylog
Configuration
Add the plugin to your NetBox configuration:
# configuration.py or plugins.py
PLUGINS = [
'netbox_graylog',
]
PLUGINS_CONFIG = {
'netbox_graylog': {
# Required: Graylog API URL
'graylog_url': 'http://graylog:9000',
# Required: Graylog API token
'graylog_api_token': 'your-api-token-here',
# Optional settings with defaults:
'log_limit': 50, # Max logs to display
'time_range': 3600, # Default time range (1 hour)
'timeout': 10, # API timeout in seconds
'cache_timeout': 60, # Cache duration in seconds
'search_field': 'source', # Field to search (source or gl2_remote_ip)
'use_fqdn': True, # Use FQDN for hostname matching
'fallback_to_ip': True, # Try primary IP if hostname not found
}
}
Graylog API Token
- Log into Graylog as an admin user
- Go to System → Users and Teams → Your User
- Click Edit Tokens
- Create a new token with at least these permissions:
searches:relativestreams:read(if filtering by stream)
Usage
Once installed and configured:
- Navigate to any Device or VirtualMachine in NetBox
- Click the Logs tab
- View recent logs from Graylog
- Use the time range buttons to adjust the search window
Search Behavior
The plugin searches for logs using this strategy:
- Hostname search:
source:{device.name} - IP fallback (if enabled and no results):
gl2_remote_ip:{primary_ip} - Source IP fallback:
source:{primary_ip}
Troubleshooting
No logs appearing
- Verify the device name in NetBox matches the
sourcefield in Graylog - Check if logs are being sent with FQDN or shortname
- Try disabling
use_fqdnif your devices use shortnames - Enable
fallback_to_ipto search by IP address
Connection errors
- Verify
graylog_urlis accessible from NetBox container - Check that the API token has correct permissions
- For Docker, ensure both containers are on the same network
Authentication errors
- Verify the API token is valid and not expired
- Check Graylog user has required permissions
Development
Setup
git clone https://github.com/sieteunoseis/netbox-graylog.git
cd netbox-graylog
pip install -e ".[dev]"
Code Style
black netbox_graylog/
flake8 netbox_graylog/
Documentation
Full documentation is available in the GitHub Wiki.
Changelog
See CHANGELOG.md for release history and breaking changes.
License
Apache License 2.0 - See LICENSE for details.
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
Credits
Inspired by the LibreNMS Graylog integration.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netbox_graylog-1.0.1.tar.gz.
File metadata
- Download URL: netbox_graylog-1.0.1.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d885f631a06574b56f74128ec9dc1b5370f709a66754b670fd2a9ac28b17d113
|
|
| MD5 |
4f962aab09b1843db8a452e1286aa34a
|
|
| BLAKE2b-256 |
38daa8ee121c329c66e4c7eeb42653727cd191c970113bfea3d2c852881a639d
|
Provenance
The following attestation bundles were made for netbox_graylog-1.0.1.tar.gz:
Publisher:
release.yml on sieteunoseis/netbox-graylog
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netbox_graylog-1.0.1.tar.gz -
Subject digest:
d885f631a06574b56f74128ec9dc1b5370f709a66754b670fd2a9ac28b17d113 - Sigstore transparency entry: 843755694
- Sigstore integration time:
-
Permalink:
sieteunoseis/netbox-graylog@0d43381f3755ac81d66f298034b2b0cf6e90725b -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/sieteunoseis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0d43381f3755ac81d66f298034b2b0cf6e90725b -
Trigger Event:
push
-
Statement type:
File details
Details for the file netbox_graylog-1.0.1-py3-none-any.whl.
File metadata
- Download URL: netbox_graylog-1.0.1-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24dbfd0c504f125c7995347e9b0b11ad3f26502c79c37da3b06ed6be96377723
|
|
| MD5 |
ce1a4cb70659d5eb8e52e6590987540e
|
|
| BLAKE2b-256 |
822cedbc0a2d3441b286004d1a75be7a275261db40e9bbdf62144126c106f24c
|
Provenance
The following attestation bundles were made for netbox_graylog-1.0.1-py3-none-any.whl:
Publisher:
release.yml on sieteunoseis/netbox-graylog
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netbox_graylog-1.0.1-py3-none-any.whl -
Subject digest:
24dbfd0c504f125c7995347e9b0b11ad3f26502c79c37da3b06ed6be96377723 - Sigstore transparency entry: 843755730
- Sigstore integration time:
-
Permalink:
sieteunoseis/netbox-graylog@0d43381f3755ac81d66f298034b2b0cf6e90725b -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/sieteunoseis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0d43381f3755ac81d66f298034b2b0cf6e90725b -
Trigger Event:
push
-
Statement type: