SShortSingh.
Back to feed

Developer Builds Offline Python Pipeline to Enrich Nginx Logs with IP and ASN Data

0
·2 views

A developer created a lightweight Python pipeline that parses Nginx access logs to generate country and ASN traffic reports without adding geolocation calls to the live request path. The tool extracts unique public IP addresses from standard combined-format logs, filters out private and loopback ranges, and batches lookups through an external geolocation API after log rotation. A SQLite cache with a seven-day expiry reduces redundant API calls, since the same IP addresses tend to recur across daily logs. The pipeline outputs results in CSV format and runs independently from the web application, so any failures do not affect live traffic. The approach avoids the latency and reliability risks of inline geolocation middleware while still giving operators visibility into whether traffic spikes originate from customers, cloud providers, or unexpected networks.

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
ProgrammingHacker News ·

Opinion: Ruby Central Criticized for Damaging Legacy in Open Source Community

A blog post published on July 30, 2026, by Andre Arko raises serious concerns about Ruby Central's impact on the Ruby open source ecosystem. The author argues that the organization has left a destructive legacy through its actions and decisions. The piece has drawn attention on Hacker News, accumulating discussion among community members. Ruby Central is the nonprofit organization responsible for overseeing key Ruby infrastructure, including RubyGems and RubyConf. The article appears to reflect ongoing tensions within the Ruby community regarding organizational governance and stewardship.

0
ProgrammingDEV Community ·

How a Marketplace Buy Box Works and Why Getting It Right Is Hard

A marketplace buy box is the mechanism that selects one winning seller offer to appear on the main 'add to cart' button when multiple sellers list the same product. The winning offer is typically chosen through a sequential set of criteria: stock availability comes first, followed by the lowest price, then seller quality signals such as premium-seller status, and finally a fixed tiebreaker rule. Because most buyers purchase without comparing all available offers, holding the buy box position captures the majority of sales for a given product, making it the most commercially valuable spot on a product page. The selection logic must be fully deterministic — returning the same winner on every page load — since any randomness erodes trust for both buyers and sellers. Poorly designed buy box logic can inadvertently reward the wrong seller behaviour, such as favouring the cheapest seller who is chronically out of stock, while sound logic can push sellers toward better pricing, reliability, and service quality.

0
ProgrammingDEV Community ·

New Metrics CD and RLF Proposed to Fix Cyclomatic Complexity's Testing Blind Spots

A software developer has proposed two new code-quality metrics — Coverage Difficulty (CD) and Responsibility Load Factor (RLF) — to address limitations in the widely used Cyclomatic Complexity (CC) measurement. CC, a heuristic dating to the 1970s, treats nested and parallel branches identically, which can underestimate the actual effort required to write exhaustive tests. CD estimates the true number of test cases needed by multiplying nested branch weights and summing parallel ones, rather than simply counting branch points. RLF is calculated by dividing CD by CC, with values significantly above 1.8 signaling that a function is far harder to test than its CC score suggests. The author also recommends refactoring high-RLF functions into flat lookup tables, a pattern they call Cross-Mapped Programming, to reduce hidden testing complexity.

0
ProgrammingDEV Community ·

How Solana's Account Model Enables Parallel Transactions Unlike Ethereum

Solana processes over 1,000 transactions per second at minimal cost by separating execution logic from data, unlike Ethereum where smart contracts store both together. On Ethereum, this bundled design causes state contention, forcing transactions that touch the same contract to be processed sequentially rather than simultaneously. Solana addresses this through its account model, where executable Programs handle logic while separate non-executable accounts store data. Because each Solana transaction must declare upfront which data accounts it will read or write, the runtime can identify non-overlapping transactions and process them in parallel. This architectural difference is a key reason Solana has gained traction in DeFi and real-world asset tokenization.