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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cf-log-util

v0.3.0

Published

Transform and filter Cloud Foundry app logs (files or live `cf logs` streams) into JSON or CSV

Downloads

51

Readme

Cloud Foundry Logging Util

npm version

cf logs gives you a wall of prefixed, multi-line text with JSON payloads buried inside it. cflogs turns that into clean, structured JSON or CSV you can filter, read, or pipe into other tools — working from either a captured log file or a live cf logs stream.

Why cf-log-util?

  • No more eyeballing raw cf logs output. Timestamps, app/instance prefixes, OUT/ERR markers, and embedded JSON payloads are parsed into clean structured records automatically.
  • One unified stream across apps. Tail a single app or several at once — multiple cf logs streams are merged into one, with an app column so you can tell records apart, which is handy when debugging across microservices.
  • Query logs instead of grepping them. A small filter expression language (=, >, <, contains, startswith, endswith, combined with and/or/parentheses) replaces chains of grep/awk/jq.
  • Control signal vs. noise. Pick exactly which properties you see — sane defaults, -p to add more, --all-props for everything, or -i for an interactive picker.
  • JSON or CSV, your choice. Feed JSON into jq or other tooling, or export CSV straight into Excel/spreadsheets for further analysis.
  • Works with the cf CLI you already have. No CF plugin to install — cflogs just wraps cf logs.
  • Zero runtime dependencies. Small, focused codebase; fast to install and fast to run.

Install

npm install -g cf-log-util

Usage

cflogs (<input-file> | -a <name>) [-p prop1,prop2] [--all-props] [-i] [-f <expr>] [--recent] [--csv]

Input

| Option | Description | | --- | --- | | <input-file> | Transform a captured log file (prints a JSON array). | | -a <name> | Run cf logs <name> and stream it as NDJSON. Repeatable or comma-separated to merge multiple apps into one stream (adds a synthetic app column). | | --recent | Pass through to cf logs --recent (no streaming). Requires -a. |

Output shaping

| Option | Description | | --- | --- | | -p <prop,...> | Include comma-separated additional properties. | | --all-props | Include every property found in each record, after the default properties and app. | | -i, --interactive | Interactively select which properties (discovered from an input file) to include. | | -f <expr> | Filter log entries using a filter expression (see below). | | --csv | Output as CSV instead of JSON. |

By default the following properties are included: logger, timestamp, level, correlation_id, msg, stacktrace.

Filter expressions

=  >  <  contains  startswith  endswith

Combine comparisons with and, or, and parentheses ( ). String values are single-quoted; contains/startswith/endswith are case-insensitive.

Examples

cflogs logs.json -p thread,request_id
cflogs logs.json --all-props
cflogs logs.json --interactive
cflogs logs.json -f "logger = 'myapp'"
cflogs logs.json -f "logger = '4' or logger = '10'"
cflogs logs.json -f "(logger = '4' or msg contains '40') and correlation_id = '439034'"
cflogs logs.json --csv
cflogs -a my-app -f "level = 'ERROR'"
cflogs -a my-app --recent
cflogs -a app1,app2 -f "level = 'ERROR'"

Requirements

  • Node.js >= 18
  • The Cloud Foundry CLI (cf) on your PATH, and logged in, when using -a <name> to stream live logs.

Development

npm install
npm test

The codebase is split into small, independently testable modules under src/lib:

  • filter.js — the -f filter expression tokenizer/parser/evaluator
  • args.js — CLI argument parsing (throws CliError on invalid input)
  • log-processing.js — extracting/transforming JSON log records
  • output.js — JSON/CSV output formatting
  • interactive.js — the -i interactive property selector
  • cf-stream.js — spawning and merging cf logs child processes

src/cli.js wires these together; bin/cflogs.js is the published executable.

License

MIT