Skip to content

[Feature]: Lightweight Self-Hosted Logs Source (No AWS Credentials Required) #366

Closed

Description

@tonychang04

What feature do you want?

Currently our logs rely on having AWS credentials for cloudwatch. This is not too friendly for people that wanted to self host.
We previously explored logflare, loki... but it doesn't look seems to work well.

We don't want another container that takes in high compute power.

Why do you need this?

We need it to let open source users able to enjoy logs!

Activity

  1. added
    enhancement
    on Oct 11, 2025
  2. HarshSharma0801 commented on Oct 12, 2025

    @HarshSharma0801
    Contributor

    I am working on this issue !

  3. tonychang04 commented on Oct 12, 2025

    @tonychang04
    MemberAuthor

    Sure! As this is a relatively complicated issue, can you briefly tell us the framework or approach you are using?

  4. HarshSharma0801 commented on Oct 12, 2025

    @HarshSharma0801
    Contributor

    hey @tonychang04 here is my approach in this , please let me know if you have anything in mind or suggestions or any framework you have in mind

    No external frameworks or libraries needed - using only Node.js built-ins.

    Approach: Provider Pattern with Auto-Detection


    Abstract Provider Interface (BaseAnalyticsProvider)

    • Defines common methods:
      getLogSources(), getLogsBySource(), searchLogs(), etc.
    • Both CloudWatch and File providers implement this interface.

    File-Based Provider (FileProvider)

    • Stores logs as JSONL (JSON Lines) — one JSON object per line
    • Uses only Node.js built-ins:
      • fs.promises → file operations
      • fs.createReadStream + readline → efficient line-by-line reading
      • path → file path handling
    • Example log files:
      logs/insforge.logs.jsonl, logs/function.logs.jsonl, etc.

    Auto-Detection Logic (AnalyticsManager)

    const hasAwsCredentials = process.env.AWS_ACCESS_KEY_ID && 
                              process.env.AWS_SECRET_ACCESS_KEY;
    
    if (hasAwsCredentials) {
      provider = new CloudWatchProvider();  // Existing
    } else {
      provider = new FileProvider();        // New
    }

    Log Writing (LogWriter)

    • Singleton service that writes to the active provider - Integrated into HTTP request middleware - Appends to JSONL files asynchronously

    Log Writing (LogWriter)

    • Singleton service that writes to the active provider - Integrated into HTTP request middleware - Appends to JSONL files asynchronously
  5. tonychang04 commented on Oct 12, 2025

    @tonychang04
    MemberAuthor

    Sounds Good! Lets see the result! As long as we can query and fetch the logs locally it works!

  6. HarshSharma0801 commented on Oct 12, 2025

    @HarshSharma0801
    Contributor

    sure will raise a PR !

  7. HarshSharma0801 commented on Oct 13, 2025

    @HarshSharma0801
    Contributor

    @tonychang04 created a PR for this issue !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions