
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
watchlog
is a Python package for monitoring log files and sending parsed logs to a specified URL using HTTP POST
requests.
You can install watchlog
using pip:
pip install watchlog
To use watchlog
, you need to create a configuration file in JSON format. Here is an example configuration file:
{
"check_interval": 5,
"check": true,
"files": [
{
"path": "/path/to/log/file.log",
"reg": "^(?P<time>[^ ]*) (?P<level>[^ ]*) (?P<module>[^ ]*) (?P<line>[^ ]*) (?P<message>.*)$",
"url": "http://example.com/api/logs",
"latest": true,
"enable": true,
"headers": {
"Content-Type": "application/json"
},
"auth": {
"username": "user",
"password": "pass"
}
}
]
}
path
: The path of the log file to monitor.reg
: A regular expression used to parse the log file.url
: The URL to send the parsed logs to.latest
: Start monitoring from the latest logs.enable
: Indicates that this configuration will be enabled, which defaults to true.headers
: A dictionary of headers to include in the HTTP POST request.auth
: A dictionary with username
and password
keys for basic authentication.check
: if open check ,it will loop check the config filecheck_interval
: circle check interval time(s)Once you have created the configuration file, you can start monitoring the log file by calling the start()
function
from the watchlog
module:
import asyncio
from watchlog import start
loop = asyncio.get_event_loop()
loop.run_until_complete(start('path/to/config.json'))
You can also use we provide small scripts
watchlog path/to/config/file
This will start monitoring the log file specified in the configuration file and sending parsed logs to the specified URL using HTTP POST requests.
example use zinc_observe as log search_engine,Illustrates the use of the process
.
āāā __init__.py
āāā config.json config file
āāā docker-compose.yml log search engine service
āāā log.log log file
āāā main.py main python file to monitor log file
watchlog
is licensed under the MIT license.
FAQs
monitoring log files and sending parsed logs to a specified URL
We found that watchlog demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Ā It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.