LogManagingSystem

A secure, efficient, and scalable log management solution built with Kotlin and Go

Overview

LogManagingSystem is a modern, secure log management solution designed for applications requiring reliable log collection and storage. Built with Kotlin for client-side operations and Go for the backend, it provides a robust and efficient way to handle application logs.

Key Features

🔒 Secure Transmission

Utilizes AES encryption with CFB mode and key derivation for secure log data transmission.

🔑 Authentication

Implements basic authentication to protect API endpoints and ensure authorized access.

📁 Organized Storage

Stores logs in directories based on device identifiers (IMEL) for efficient retrieval.

⚡ High Performance

Go backend ensures fast and efficient log processing and storage.

🌐 Cross-Platform

Kotlin client enables easy integration with various platforms and applications.

🔄 Retry Mechanism

Built-in retry logic for handling network issues and ensuring log delivery.

Kotlin Client Usage

The Kotlin client library provides a simple and secure way to send logs to the server. Here's how to use it:

import kotlinx.coroutines.runBlocking
import org.aria.danesh.logmanagingkotlinlib.LogManagingKotlinLib

fun main() = runBlocking {
    val logManager = LogManagingKotlinLib(
        apiUrl = "http://your-api-host:port",
        username = "your-username",
        password = "your-password",
        encryptionKey = "your-32-byte-encryption-key",
        maxRetries = 3,
        retryDelay = 1,
        timeout = 30
    )

    val result = logManager.sendEncryptedLog(
        imel = "device-identifier",
        error = "Error message",
        level = "ERROR",
        source = "application-name"
    )

    result.fold(
        onSuccess = { message -> println("Log sent successfully: $message") },
        onFailure = { exception -> println("Error sending log: ${exception.message}") }
    )
}
Note: The Kotlin client includes built-in retry logic and timeout handling for improved reliability.

Dependencies

Add the following dependencies to your Kotlin project:

dependencies {
    implementation("org.aria.danesh:logmanagingkotlinlib:1.0.0")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
    implementation("com.squareup.okhttp3:okhttp:4.12.0")
}

Go Backend Setup

The Go backend provides a secure API for receiving and storing encrypted logs. Here's how to set it up:

  1. Clone the Repository: Get the latest version from GitHub.
  2. Configure Environment: Set up your environment variables for authentication and encryption.
  3. Build and Run: Use the provided build script or run directly with Go.
# Build the API
./build.bat

# The executable will be created in build/api/LogManagingApi-windows-64.exe
Security Note: Always use strong encryption keys and secure credentials. Never commit sensitive information to version control.

API Endpoints

The API provides the following endpoints:

# Example using curl
curl -X POST \
  -H "Authorization: Basic $(echo -n 'username:password' | base64)" \
  -H "Content-Type: application/json" \
  -d '{"encrypted_data":"your-encrypted-data"}' \
  http://localhost:8080/

Contributing

We welcome contributions! Please feel free to submit pull requests or report issues on our GitHub repository.

Visit our repository: arya458/LogManagingSystem