StatsRaven

DocsAsk

Networks and IP addresses

Every request and page view carries the network it came from: its ASN, its name, whether it is a data center and whether its ASN is on the bad ASN list. StatsRaven counts traffic per network as it arrives and keeps those counts for 400 days. The IP address itself is held only in memory and never stored.

On this page
  1. What StatsRaven knows about a network
  2. Where you see it
  3. Four questions, answered
  4. How the counts are kept
  5. IP addresses
  6. Where networks come from
  7. Keeping it fresh
  8. In MCP and SQL
  9. Licenses

What StatsRaven knows about a network#

ASN
The number of the autonomous system that announces the address, such as 3320 for Deutsche Telekom or 24940 for Hetzner. Shown as a small tag, AS24940, beside the network's name.
Network
The name of the operator behind the ASN, such as Deutsche Telekom AG or Hetzner Online GmbH.
Data center
A hosting or cloud network. People rarely browse from one; programs usually do. A network counts as one when its ASN is on the bad ASN list, or when its name reads like a hosting company's.
Bad ASN
The ASN is on the public bad ASN list of cloud, hosting and colocation networks. Googlebot comes from such a network too, so a bad ASN says where traffic came from, not that it was harmful.

These four are kept with each request. They name a network, not a person, so they are never hidden from editors or viewers.

Where you see it#

  • Networks in the menu: every network of the last hour, 24 hours, 7, 30 or 90 days, most traffic first, for each kind of traffic, with data centers, bad ASNs and the rest apart. The three largest are drawn over time. A network opens beside the list with its traffic by kind, the pages, agents, countries and statuses it reached, and who on it is online now.
  • Overview: a Networks card for the period and the kind of traffic in view, with the networks of the people online now as a tab.
  • Live: an open row shows the person's network and IP address. With more than ten people online, the Technology card has a Networks tab, and a network in it filters the list. Rows from a data center or a bad ASN say so.
  • Tail: each line names its network, ASN and address. Data centers and Bad ASNs narrow the stream, and an open line has Only this IP and Only this network.

Four questions, answered#

QuestionIn the appWith Claude or MCP
Which networks are the people online right now on?Overview, Networks card, Online now. Live, Technology, Networksonline_now, its networks
Which networks sent the most traffic in the last 24 hours?Networks, 24hnetwork_report with period 24h
Which bad ASNs sent the most traffic in 30 days?Networks, Bad ASNs, 30dnetwork_report with only bad and period 30d
Which data center networks came in the last hour?Networks, Data centers, 1hnetwork_report with only datacenter and period 1h

In chat, ask in your own words: chat uses the same tools.

How the counts are kept#

Traffic is counted per network, project and kind of traffic (people, bots, API, unclassified) as it arrives: requests your servers logged, page views the snippet sent, errors (status 400 and up) and visitors. A visitor counts once a day per network, as everywhere in StatsRaven, where a visitor code lasts a day.

  • The last two days are kept in 10 minute slices, so the last hour is sharp to 10 minutes.
  • Up to eight days back, slices are hours; after that, days.
  • Counts are kept for 400 days, whatever the retention of raw events, as the hourly rollups are. They hold no IP address and no visitor code.

IP addresses#

StatsRaven reads the address of each request to find its network and to make the anonymous visitor code. The address itself is never written to disk. It stays in memory while it is useful: on Live while the person is online and for the 30 minutes after, and on Tail while the line is among the last thousand.

WhoSees addresses
AdminsWhole
Editors and viewersAs set in Settings, Privacy, IP addresses: whole, with the last part hidden (203.0.113.x, the default), or hidden
MCP and SQL API tokensWhole, in online_now and live_requests. No table or query holds an address

Filtering by address works only for people who see addresses whole. Addresses and emails inside log text are always masked.

Behind a proxy#

Behind Cloudflare, StatsRaven reads CF-Connecting-IP. Behind a proxy on the same machine or the local network, such as Caddy or nginx, it reads X-Real-IP or the first X-Forwarded-For address. A request from anywhere else could write those headers itself, so then the address of the connection counts. Pass the address on in nginx with:

nginx
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Where networks come from#

  1. Cloudflare, for Cloudflare Workers logs: the ASN and name Cloudflare gives each request always win.
  2. Your provider, when you choose one in Settings, Storage, Network data.
  3. The built-in table, which every StatsRaven release carries: the IP to ASN ranges of iptoasn.com and the bad ASN list.

Lookups happen inside StatsRaven, from the table in memory. Nothing is looked up online. With Off chosen, only the networks Cloudflare names count.

SourceWhat you giveLicense
Built-in tableNothingPublic Domain (PDDL) and MIT, part of StatsRaven
MaxMind GeoLite2-ASNYour account ID and license keyYours, with MaxMind
IPinfo LiteYour tokenYours, with IPinfo
DB-IP ASN LiteNothingCC BY 4.0. The Networks page links to db-ip.com while it is chosen
An MMDB fileIts path on the serverYours. Keep it current with geoipupdate or your provider's tool; StatsRaven reads it again when it changes

To name addresses no table knows, such as your office or a test network, give StatsRaven a file of ranges with STATSRAVEN_ASN_OVERLAY=/path/to/ranges.tsv. Each line is a start address, an end address, an ASN, a country code and a name, separated by tabs. These ranges are looked up before any other.

Keeping it fresh#

Networks change hands slowly, so the table of your release is good for months. To keep it current, turn on Update weekly in Settings, Storage, Network data, or answer yes when Get started asks. Then, once a week:

  • StatsRaven downloads the ranges from iptoasn.com, or from its mirror on GitHub when iptoasn.com cannot be reached, and the bad ASN list from GitHub. With a provider chosen, it downloads the provider's file with your key.
  • A new table is used only after it passes its checks: well-known addresses land in the right networks, and it has not lost a large part of the ranges in use. It replaces the old one without a restart.
  • A download that fails changes nothing: StatsRaven keeps the table it has, for as long as it takes, and tries again after an hour, six hours, then daily. Admins see a note at the top of the app saying since when updates fail and which table is in use.

Without weekly updates StatsRaven makes no outbound connection for this, and every update of StatsRaven brings a fresh table. An install that does not update and runs a table older than 90 days shows admins a note. Update now downloads at once. The hosts are listed in what StatsRaven connects to.

In MCP and SQL#

network_report answers questions about networks over a period, and about one network with asn. online_now filters by asn, network, datacenter and bad and lists the networks of the people online. live_requests gives the requests of the last 30 minutes with their network and address. In run_query, asn, network, datacenter, datacenter_by and bad_asn are fields to filter and group by. See Claude and MCP.

In SQL, read them from the events with attr(), or use the asn_stats table of counts:

The bad ASNs of the last 30 days
SELECT asn, network, sum(requests + pageviews) AS hits, sum(visitors) AS visitors
FROM asn_stats
WHERE bad_asn AND start >= now() - INTERVAL '30 days'
GROUP BY asn, network
ORDER BY hits DESC
LIMIT 10

See the SQL API for its columns.

Licenses#

The built-in table is made of data anyone may use, sell and ship, so it can travel inside StatsRaven:

  • IP to ASN ranges: IPtoASN by Frank Denis, iptoasn.com, in the Public Domain under the PDDL v1.0. Its mirror, sapics/ip-location-db, publishes the same data under the same license.
  • The bad ASN list: brianhama/bad-asn-list, MIT, copyright 2025 Brian Hamachek. Its notice ships with every release in THIRD_PARTY_NOTICES.md.

MaxMind, IPinfo and DB-IP are not part of StatsRaven. When you choose one, StatsRaven downloads it with your account, under the license you agreed with that provider.