log.http
#
Description#
This plugin can be used to monitor one or more HTTP log files (tested on Apache and Nginx) and trigger events whenever a new log line is added.
Configuration#
log.http:
# [Required]
# List of log files to be monitored.
paths: # type=Iterable[str]
# [Optional]
# log_files: # type=Optional[Iterable[str]]
# [Optional]
# How often the `RunnablePlugin.loop <https://docs.platypush.tech/platypush/plugins/.html#platypush.plugins.RunnablePlugin.loop>`_ function should be
# executed (default: 15 seconds). *NOTE*: For back-compatibility
# reasons, the `poll_seconds` argument is also supported, but it's
# deprecated.
# poll_interval: 15 # type=Optional[float]
# [Optional]
# How long we should wait for any running
# threads/processes to stop before exiting (default: 5 seconds).
# stop_timeout: 5 # type=Optional[float]
# [Optional]
# If set to True then the plugin will not monitor
# for new events. This is useful if you want to run a plugin in
# stateless mode and only leverage its actions, without triggering any
# events. Defaults to False.
# disable_monitor: False # type=bool
Dependencies#
pip
pip install watchdog
Alpine
apk add py3-watchdog
Debian
apt install python3-watchdog
Fedora
yum install python-watchdog
Arch Linux
pacman -S python-watchdog
Triggered events#
Module reference#
- class platypush.plugins.log.http.LogEventHandler(*args: Any, **_)[source]#
Bases:
EventHandler
- class platypush.plugins.log.http.LogHttpPlugin(paths: Iterable[str], log_files: Iterable[str] | None = None, **kwargs)[source]#
Bases:
FileMonitorPlugin
This plugin can be used to monitor one or more HTTP log files (tested on Apache and Nginx) and trigger events whenever a new log line is added.
- __init__(paths: Iterable[str], log_files: Iterable[str] | None = None, **kwargs)[source]#
- Parameters:
paths – List of log files to be monitored.
- static event_handler_from_resource(resource: str) LogEventHandler [source]#
Create a file system event handler from a string, dictionary or
MonitoredResource
resource.
- main()#
Implementation of the main loop of the plugin.
- start()#
Start the plugin.
- stop()#
Stop the plugin.
- wait_stop(timeout=None)#
Wait until a stop event is received.