A Node-RED logging node with multiple outputs using the winston,winston-elasticsearch and winston-loki logging libraries
npm install node-red-contrib-log-elknode-red-contrib-log-elk is a Node-RED logging output node that supports multiple logging destinations, including ElasticSearch, Loki (Grafana), local files, the system console, and the Node-RED debug window. This node is designed to provide flexible and configurable logging options for Node-RED flows.
http://localhost:9200).
http://localhost:3100).
json
{
"X-Scope-OrgID": "${TENANT}"
}
`
- App Label: A label to identify the application in Loki logs (e.g., node-red).
3. File:
- Filename: The name of the log file (e.g., log-elk.log).
- File Size: The maximum size of the log file in megabytes (minimum: 1 MB).
- Max Files: The maximum number of log files to retain (minimum: 1).
4. System Console:
- Logs messages to the system console for debugging or monitoring.
5. Debug Window:
- Logs messages to the Node-RED debug window for easy access during development.
---
Environment Variables
You can use environment variables to dynamically configure the logger. For example, instead of hardcoding the ElasticSearch URL or Loki credentials, you can use ${ENV_VAR}` syntax in the fields. At runtime, these placeholders will be replaced with the corresponding environment variable values.