Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
log-watcher
Advanced tools
Watches log files for changes and sends a notification if a pre-defined pattern is detected or a tracked file is deleted.
Watches log files for changes and sends a notification / alert using one or more of the available methods provided by a plugin (stdout, email and webhook) if a pre-defined pattern is detected or a tracked file is deleted.
npm install log-watcher
In a configuration file you specify which files to watch for changes, match patterns and notification options.
{
"/var/log/messages": {
"patterns": {
"usb_disconnect": {
"pattern": "USB disconnect, address \\d+",
"case_sensitive": false,
"description": "USB device has been disconnected"
},
"usb_connect": {
"pattern": "new low|full speed USB device",
"case_sensitive": false,
"description": "USB device has been connected"
}
},
"options": {
"notify_on_not_available": true
},
"notifications": {
"webhook": {
"urls": [ "http://example.foo.bar/hook" ]
},
"email": {
"from": "notifications@foo.bar",
"addresses": [ "example@foo.bar" ]
},
"stdout": {
}
}
}
}
Object keys are tracked file paths. In this case, one file is tracked - /var/log/messages
patterns
- object where a key is a short pattern name ([a-zA-Z0-9-_]+) and a value is a pattern object with the following keys:
pattern
- regular expression match patterncase_sensitive
- true if you want the pattern to be case sensitive, false otherwise (if case_sensitive
is false, 'i' flag is added to the created RegExp object).description
- pattern descriptionoptions
- object with the following keys:
notify_on_not_available
- true to send a notification when a file is unavailable (deleted)notification
- object which defines how to send a notification if a defined pattern is detected or a file is deleted. Key is a plugin name and a value is an object with the plugin options. Currently available plugins are:
stdout
- prints notification to standard outputemail
- sends a notification to a single or multiple email addresseswebhook
- sends a notification payload as a POST request to a single or multiple URLsFor the available plugin options, view the corresponding plugin source code: lib/plugins/<plugin_name>.js
Note #1: Because a pattern value is a string not a RegExp object, all the backslashes before special regular expression characters must be escaped. For example: \d+
-> \\d+
, \w
-> \\w
Note #2: Notifications are common to a tracked file a not a pattern which means that if you define two patters for a single file, same notification methods will be used for both patterns.
log_watcher --config <path to the config file>
Work in progress.
26.12.2010 - Initial release
FAQs
Watches log files for changes and sends a notification if a pre-defined pattern is detected or a tracked file is deleted.
The npm package log-watcher receives a total of 0 weekly downloads. As such, log-watcher popularity was classified as not popular.
We found that log-watcher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.