npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

poptop

v0.1.4

Published

Quick and dirty reports on the most popular URLs and searches in an Apache or Nginx-style log file

Downloads

4

Readme

Purpose

You have Apache and Nginx-format log files, for private sites without Google Analytics. You'd like to know what the most popular URLs have been lately. You don't want to install a complex log analysis package. You just want a quick report, right now.

Install

npm install -g poptop

Usage

tail -50000 /var/log/nginx/mysite.access.log | poptop

Out comes a list of URLs sorted by popularity.

That list includes pages not found and other errors. Want to kick those out?

tail -50000 /var/log/nginx/mysite.access.log --successful | poptop

Want to focus on the "404 not found" errors?

tail -50000 /var/log/nginx/mysite.access.log --notfound | poptop

Reading the results in terminal? Want the most popular URLs at the bottom? No problem:

tail -50000 /var/log/nginx/mysite.access.log | poptop -r

That's great, but you don't care about static assets like .gif, .png, etc. OK, let's ignore them:

tail -50000 /var/log/nginx/mysite.access.log | poptop --ignore-static

Query strings are showing up as separate accesses. Let's clobber those:

tail -50000 /var/log/nginx/mysite.access.log | poptop --ignore-query

How about totals for folders?

tail -50000 /var/log/nginx/mysite.access.log | poptop --ignore-static --folders

Don't want to count 302 and 304 redirects themselves as successful?

tail -50000 /var/log/nginx/mysite.access.log | poptop --ignore-redirects

Here's a really fancy command line from my actual life:

tail -100000 mysite.access.log | poptop --ignore-static --ignore-query --successful --ignore-redirects "--ignore=/admin|svn|/logout|/login" --folders

Search report

After popular pages, the second most common question is "what did people search for?" Use the --search option to find out:

tail -50000 /var/log/nginx/mysite.access.log | poptop --search=/search,q

You'll need to specify the URL where searches happen, and the query string parameter that contains the search string, separated by a comma.

(If your search engine uses POST requests, the search string won't be in the logs, so I can't help you there.)

Other options

You can also ignore individual file extensions with --ignore-extensions. For convenience, --ignore-static is equivalent to --ignore-extensions=gif,jpg,png,js,xlx,pptx,docx,css,ico,pdf.

And, you can ignore any regular expression you wish with the --ignore option. Be sure to quote it to avoid shell issues.

Credits

poptop was created to facilitate our work at P'unk Avenue.

Changelog

0.1.4: added --ignore-redirects and a report of total accesses.

0.1.3: added woff and eot to --ignore-static.

0.1.2: the --ignore-extensions option works properly. Also, extensions are still ignored if they are followed by a query string.