SShortSingh.
Back to feed

How to Stream Live Server Logs to a Browser Using journald and SSE

0
·1 views

A developer built a real-time log viewer for an admin panel by combining two existing Linux tools: systemd's journald and Server-Sent Events (SSE), which browsers have supported since around 2011. The setup requires no third-party log shippers, agents, or external dashboards — just a spawned journalctl process piping output directly to the browser via an EventSource connection. Because systemd automatically captures stdout and stderr from any service unit, no special logging configuration is needed; the app simply writes JSON to standard output. The journald flags -f, -n 0, and -o json enable live, machine-readable log streaming with minimal code. The author frames the approach as a pragmatic alternative to running custom supervisors or dedicated log daemons on distros like Ubuntu, Debian, and Fedora where journald is already the default.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Virtual Thread Pinning: How a Silent JVM Bug Caps Your App's Throughput

Java's virtual threads, introduced via Project Loom, can silently revert to behaving like a bounded thread pool due to a phenomenon called 'pinning,' where a virtual thread cannot unmount from its carrier OS thread during a blocking operation. This occurs in exactly two scenarios: blocking inside a synchronized block (in JDK 21–23) and blocking within native or JNI frames, the latter remaining unfixed even in JDK 24. When pinning occurs repeatedly in a hot code path, all carrier threads — limited by default to the number of CPU cores — can stall simultaneously, causing scheduler starvation that mimics a deadlock from the outside. JDK 24 resolves the synchronized pinning issue by decoupling object monitors from carrier threads, but native frame pinning persists and can hide in unexpected places like static initializers. Developers are advised to audit blocking calls inside synchronized methods and third-party libraries, and use JVM diagnostics to detect pinning before it silently degrades throughput.

0
ProgrammingDEV Community ·

Developer cuts AI costs by routing agent calls through coding assistants instead of LLM APIs

A developer has shared a method of replacing direct large language model API calls with coding assistant agents, such as Claude Code or GitHub Copilot, to reduce costs when building AI systems. Standard LLM API pricing typically ranges from $2 to $7 per million tokens, while coding assistant subscriptions can translate to as little as $0.08 per million tokens. The approach involves wrapping a coding assistant's command-line interface in a lightweight integration layer, enabling it to function as a drop-in LLM backend without a native API. A Python module using subprocess calls to the Claude CLI was developed to support both plain-text and structured outputs, including a LangChain-compatible adapter. The key trade-off is that coding assistants lack a direct API, but the author argues this is easily overcome through CLI-based wrappers.

0
ProgrammingDEV Community ·

Deploying a Solana Program to Mainnet: Key Risks and Responsibilities

Moving a Solana program from devnet to mainnet is a significant shift that goes beyond running a few commands. On mainnet, deployment costs real SOL, the program is immediately accessible to any user or bad actor, and any mistakes are permanently recorded on a public ledger. A critical decision developers must make before launch is whether to retain or revoke the program's upgrade authority, which controls the ability to push future updates. Keeping upgrade authority allows bug fixes but requires users to trust the developer will not push malicious changes, while revoking it makes the program immutable and maximally trustworthy but eliminates any ability to patch vulnerabilities. Most teams treat this as a nuanced, staged decision rather than a simple binary choice made at launch.

0
ProgrammingDEV Community ·

Slack Debuts AI-Driven Agentic Testing; Devs Weigh Memory Layers for TypeScript Agents

This week's developer-focused roundup covers three key areas of AI agent development: memory architecture, test automation, and content workflows. Slack Engineering has introduced 'Agentic Testing,' an AI-driven approach where agents autonomously explore user interfaces to identify bugs and edge cases, replacing brittle hand-written test scripts. On the memory front, a technical comparison examines Mem0 and TurboMem, two solutions for managing state in TypeScript-based AI agents, weighing service-based versus embedded memory architectures. A separate piece traces one developer's evolution from simple prompt files to unified agent-driven content automation workflows. Together, these articles reflect growing industry interest in applying AI agent orchestration to practical, production-grade engineering challenges.