HUB
Sign inSign up

articrexus/jiriflow

By articrexus

•Updated over 1 year ago

log monitoring service API-triggered logs and alerts users exclusively for critical system failures.

Image
Security
Monitoring & observability
Web analytics
0

384

articrexus/jiriflow repository overview

NOTE: Most of this code was done by AI as a experiment (In future this will be rewritten) ALSO VERY BUGY

⁠Introduction

JiriFlow is a real-time log monitoring system designed to centralize logging from various services and servers.

⁠Security Best Practices

  1. Change default admin password immediately
  2. Generate a secure random API key
  3. Use HTTPS in production
  4. Keep dependencies updated regularly
  5. Use a reverse proxy in production environments

⁠Table of Contents

⁠License

MIT⁠

⁠Disclaimer

This software is provided "as is" without any guarantees or warranties. Use at your own risk.

⁠JiriFlow API Documentation

⁠JiriFlow Overview

JiriFlow is a real-time log monitoring system designed to centralize logging from various services, applications, and servers. Key features include:

  • Unified Logging: Collect logs from multiple sources in one centralized dashboard
  • Real-time Monitoring: View log events as they happen with WebSocket-based live updates
  • Alert System: Alerts for critical events with visual and audio notifications
  • RESTful API: Simple API for sending log data from any application or service
  • Flexible Service Identification: Organize logs by service, context, or application
  • Severity Levels: Different log levels (info, warning, error, critical) with corresponding visual indicators

Note: JiriFlow uses WebSockets to provide real-time log updates without requiring page refreshes.

⁠Authentication

All API requests require an API key included directly in your JSON payload or as a header. API key:

⁠In the JSON request body:
{
  "apiKey": "your-api-key-here",
  // other fields...
}
⁠API Key Management

Your API key can be managed in the Settings⁠ page. You can:

  • View your current API key (in the browser console for security)
  • Generate a new API key (invalidates the previous key)

Note: The API key is generated automatically on first run and stored securely in the database.
Warning: Keep your API key secure! Anyone with your API key can send logs to your system.

⁠Installation & Setup

⁠GitHub (Local Development)
  1. Clone or download the project repository.
  2. Navigate to the project directory in your terminal.
  3. Install dependencies: npm install
  4. Run the application: npm start or node main.js
  5. Access the dashboard and API endpoints in your web browser (usually at http://localhost:3000 or https://localhost:3000).
⁠Docker
  1. Pull the Docker image: docker pull articrexus/jiriflow
  2. Run the Docker container, mapping port 3000: docker run -d -p 3000:3000 articrexus/jiriflow
  3. Access the dashboard and API endpoints in your web browser (usually at http://localhost:3000 or https://localhost:3000).
  4. If the application is not accessible, try restarting the container.

⁠API Endpoints

⁠POST /api/logs

Create a new log entry that will appear in real-time on the dashboard.

⁠Request Body:
{
  "apiKey": "your-api-key-here",  // Required for authentication
  "level": "info",                // "info", "warning", "error", or "critical" (can also use "type" field instead)
  "message": "Your log message",  // Required
  "service": "my-service",        // Optional: any string value for categorizing logs (also accepts "context")
  "serverName": "Server-1",       // Optional: server name
  "serverIp": "192.168.1.10"      // Optional: server IP address (auto-detected if not provided)
}
⁠Field Descriptions:
FieldRequiredDescription
apiKeyRequiredYour JiriFlow API key for authentication
level or typeOptionalLog severity level. Values: "info", "warning", "error", "critical". Default: "info"
messageRequiredThe log message content
service or contextOptionalService or application name. Default: "general"
serverNameOptionalName of the server or container generating the log
serverIpOptionalIP address of the server (auto-detected if omitted)

Note: You can use either level or type to specify the log level. Both fields work the same way.
Note: You can use either service or context for the service name. Both fields work the same way.
Important: The critical level will trigger visual and audio alerts in the browser to get immediate attention!

⁠Example with critical error:
{
  "apiKey": "your-api-key-here",
  "type": "critical",
  "message": "SYSTEM FAILURE: Primary database is offline",
  "service": "database-cluster",
  "serverName": "Production-DB-Main"
}
⁠Example with type field:
{
  "apiKey": "your-api-key-here",
  "type": "error",
  "message": "Database connection failed",
  "service": "database-service",
  "serverName": "DB-Server-1"
}
⁠Response (201 Created):
{
  "id": 123,
  "level": "info",
  "message": "Your log message",
  "timestamp": "2025-04-02T15:30:45.123Z",
  "service": "my-service",
  "serverName": "Server-1"
}
⁠Error Responses:
Status CodeDescription
400 Bad RequestMissing required fields or invalid format
401 UnauthorizedInvalid or missing API key
500 Internal Server ErrorServer encountered an error processing the request

Additional Notes on Error Handling:

  • 400 Bad Request: Often due to missing fields. Verify the request body structure.
  • 401 Unauthorized: Check if the API key is valid and sent correctly.
  • 500 Internal Server Error: Inspect server logs for deeper troubleshooting.

⁠Integration Examples

⁠cURL Example:
curl -X POST <%= baseUrl %>/api/logs \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "your-api-key-here", 
    "level": "error", 
    "message": "Failed to connect to payment gateway", 
    "service": "payment-service"
  }'
⁠JavaScript/Node.js Example:
fetch('<%= baseUrl %>/api/logs', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    apiKey: "your-api-key-here",
    level: "error",
    message: "Database connection failed",
    service: "database-service",
    serverName: "DB-01"
  })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
⁠Python Example:
import requests
import json

url = "<%= baseUrl %>/api/logs"
payload = {
    "apiKey": "your-api-key-here",
    "level": "warning",
    "message": "High memory usage detected",
    "service": "monitoring-agent",
    "serverName": "web-server-01"
}

response = requests.post(url, json=payload)
print(response.status_code)
print(response.json())
⁠Postman Example

To test in Postman, set the request method to POST, then add the following JSON body: /api/logs

{
  "apiKey": "YOUR-API-KEY-HERE", 
  "level": "critical", // "info", "warning", "error", or "critical" (can also use "type" field instead)
  "message": "cant connect to database",
  "service": "database",
  "serverName": "https",
  "serverIp": "xxx.xxx.xxx.xxx"
}

⁠Future Endpoints (Coming Soon)

The following endpoints are planned for future releases:

  • POST /api/logs/bulk - Create multiple log entries in a single request
  • GET /api/logs - Retrieve logs with filtering and pagination
  • GET /api/logs/export - Export logs to CSV format
  • GET /api/status - Check API status and get basic information

Check back for updates or subscribe to our release notifications.

⁠Examples of Service Names

The service (or context) field can be any string value you choose. Here are some examples:

Use CaseExample Service Names
Microservices Architectureauth-service, user-service, payment-service
Application Componentsfrontend, backend, database, cache
Application Modulesuser-management, reporting, admin-panel
Process Typesweb-server, background-job, cron-task
Deployment Environmentsproduction-api, staging-worker, dev-frontend

⁠Real-time WebSocket Updates

JiriFlow uses WebSockets to provide real-time log updates to the dashboard. When a log is received via the API, it is automatically broadcast to all connected clients.

Note: The WebSocket connection is automatically established when you visit the dashboard. No additional configuration is required.

All logs sent to the API will immediately appear in the dashboard for all connected users, making JiriFlow ideal for real-time monitoring and collaborative troubleshooting.

⁠Security Considerations

When integrating with JiriFlow, consider the following security best practices:

  • API Key Protection: Store your API key securely and never expose it in client-side code
  • HTTPS Usage: Always use HTTPS when sending logs to protect sensitive information
  • Regular Key Rotation: Periodically regenerate your API key, especially if team members leave
  • Minimal Information: Only include necessary information in log messages, avoid sensitive data
  • IP Restrictions: Consider using network-level restrictions to limit where logs can be sent from

Warning: Never include passwords, tokens, or personally identifiable information in log messages.

⁠Modifying user-config.json

The user-config.json file allows you to customize various settings of JiriFlow. Here's how you can modify it to suit your needs:

  1. Locate the file: The user-config.json file is located in the root directory of your JiriFlow installation.
  2. Edit the file: Open the user-config.json file in a text editor.
  3. Modify values: Change the values of the settings you want to customize. For example, to change the server port, modify the "port" value under the "server" section.
  4. Save the file: Save the changes you made to the user-config.json file.
  5. Restart JiriFlow: Restart the JiriFlow application for the changes to take effect.

Here's an example of the user-config.json file with descriptions of each setting:

{
  "server": {
    "port": 3000, // The port the server listens on.
    "host": "0.0.0.0", // The host the server listens on.
    "enableHttps": true // Enable or disable HTTPS.
  },
  "security": {
    "defaultAdmin": {
      "username": "admin", // Default admin username.
      "password": "admin"  // Default admin password.
    },
    "sessionTimeout": 24 // Session timeout in hours.
  },
  "database": {
    "path": "./data/database.db" // Path to the SQLite database.
  },
  "logging": {
    "directory": "./logs", // Directory to store log files.
    "level": "info", // Log level (info, warning, error, critical).
    "maxSize": "10m", // Maximum size of a log file.
    "maxFiles": 5, // Maximum number of log files to keep.
    "httpLogging": true // Enable or disable HTTP request logging.
  },
  "certificates": {
    "method": "selfsigned", // Method to generate SSL certificates (selfsigned, mkcert, openssl, node-forge).
    "paths": {
      "cert": "./certificates/certificate.pem", // Path to the SSL certificate file.
      "key": "./certificates/private-key.pem"  // Path to the SSL key file.
    }
  }
}

Note: Ensure the JSON syntax is correct when modifying the user-config.json file. An invalid JSON format may prevent JiriFlow from starting correctly.

⁠FAQ

Q: Why am I getting a 401 error?
A: Ensure your API key is correct and provided in the request headers or body.

Q: How do I rotate my API key?
A: Use the Settings page to generate a new key, invalidating the old one.

⁠Changelog

0.1 : Release

Tag summary
Recent tags
Content type
Image
Digest
sha256:7c2acca76…
Size
96.6 MB
Last updated
over 1 year ago
docker pull articrexus/jiriflow:latest