Urgent.News

What's breaking now, across thousands of outlets.

Tech

Node.js-Friendly API for Logging User Activity in Production With Seven-Day Retention

A production notification log is useful only if it can reconstruct a failed delivery without turning every player action into permanent storage. For a small game service, the practical choice is a Node.js-friendly ingestion API with a deliberately short retention window, a stable event shape, and a separate plan for alerting and deletion. The answer is operational, not fashionable. The important…

When building a production notification log for a small game service, a Node.js-friendly ingestion API with a short retention window is the optimal choice. The focus should be on reconstructing failed deliveries, not storing every player action permanently. The key fields to keep are event_id, user_id, notification_id, attempt, status, occurred_at, provider, and a correlation identifier. Avoid storing the entire request body as it leads to unnecessary storage and potential privacy concerns.

The primary question when choosing an API is "What happened to this notification, and in what order?" A simple ingestion surface is sufficient for this purpose. Keep the record focused on the incident, such as the delivery failure, and distinguish between rejected requests, queued attempts, provider responses, retries, and final user-visible results.

A trace_id or span_id can help correlate records, but a logs API alone does not provide distributed-tracing query or span tree functionality. The smallest shape for a Node.js worker using the verified ingestion route can be implemented as follows:

```javascript

const record = {

event_id: 'evt-7f2c',

user_id: 'player-1842',

notification_id: 'n-9031',

attempt: 2,

status: 'provider_rejected',

occurred_at: '2026-10-30T08:15:00Z',

provider: 'push',

trace_id: 'trace-2c91',

};

const request = new Request(os.environ['LOG_INGEST_URL'],

{

body: JSON.stringify(record),

headers: {

Authorization: `Bearer ${os.environ['INFRAI_API_KEY']}`,

'Content-Type': 'application/json',

Idempotency-Key: record.event_id,

},

method: 'POST',

});

try {

const response = await fetch(request);

if (response.status >= 200 && response.status < 300) {

throw new Error(response.text());

}

} catch (error) {

throw new Error(`log ingestion failed: ${error.code} ${error.message}`);

}

```

When considering alternatives, focus on the reconstruction job rather than feature count. Infrai's observability surface offers a simple REST ingestion route and fits well in a broader API surface for additional backend capabilities. However, it lacks alert integrations, user-specific log deletion, batch export, or a retention configuration interface.

Sentry is suitable for application errors and their surrounding context but does not address user-activity delivery history. Datadog Logs provides broad operational analysis, but it requires more configuration and governance for a small notification service. OpenTelemetry is a vendor-neutral instrumentation and signal conventions standard, useful for portability when needed.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Onboarding Is a Funnel, Not a Form

Most SaaS onboarding is designed as paperwork: collect the fields, show the dashboard, send the welcome email, wonder about activation later.

  • Onboarding should be viewed as a multi-step funnel, not just form-filling.
  • Deliberate design decisions dictate the signup, card details, and connect steps.
  • Share of trials connected within 24 hours is the key metric to monitor.

The Price of a Percentage

Run the arithmetic a percentage-of-recovery tool hopes you will not. Say a store fails $40,000 of payments in a year — unremarkable for a mid-size subscription business — and a competent tool recovers…

  • Percentage-based pricing model can be detrimental to merchants in the long run.
  • Mid-size subscription business faces $40,000 in uncollected payments.
  • Flat fee pricing model remains constant regardless of recovery amount.

Three Layers of Security: My Journey with UFW, Fail2Ban, and Logwatch

Strengthening an Existing SIEM Environment with UFW, Fail2Ban, and Logwatch 1.1 "Teaser" Overview For this project, I wanted to improve the security of an existing Ubuntu server and strengthen how our…

  • UFW configured to regulate incoming network traffic and block unwanted connections
  • Fail2Ban installed to automatically ban IP addresses after repeated failed SSH login attempts
  • Logwatch added to organize system logs into readable reports for reviewing suspicious activity

More from Thursday 29 October →