seqcli - the Seq command-line client

Seq frequently gets integrated into all kinds of ops tools and processes:

  • Deployment scripts log version information, start, progress and completion events
  • Scheduled tasks log their activities to let the world know that they've run
  • Query results are exported into downstream BI systems to be combined with other application data
  • Events are exported for archival storage and to analyze with scripts and other apps

These tasks are usually achieved with PowerShell scripts, or by calling the Seq HTTP API using a programming language such as C#.

The new Seq command-line client, seqcli, is an even easier way to get data into and out of Seq:

The Seq command-line client

It's a self-contained, cross-platform app that can handles log ingestion, search, and analysis with a minimum of fuss.

Getting data in

There are two ways to send log data to Seq using seqcli. The seqcli log command sends a single event:

seqcli log -m 'Beginning deployment of v{Version}' -p Version=1.2.3 -p Environment=Test  

Log files and application output can be sent using the seqcli ingest command. Currently this assumes that events will be formatted as compact JSON, but we have plans to add plain text and other JSON formats in the near future.

Getting data out

Retrieve raw events with seqcli search:

seqcli search -f "@Level = 'Error'" -c 10  

The seqcli tail command is just like search, but streams results to the terminal in real-time as events arrive at Seq.

Analytic queries can be performed using seqcli query:

seqcli query \  
  -q "select percentile(Elapsed, 90) from stream where Path like '/health/%'" \
  --start="2018-02-20T10:00Z"

The results are formatted as CSV, which makes it easy to pipe them on into many different data stores and analysis tools.

All three commands support --json and --no-color output options.

Status

A Windows installer and .tar.gz archives for macOS and Linux are currently available from the releases page. Instructions for configuring the default Seq server URL and API key are in the README.

We're planning a 1.0 release of seqcli in conjunction with our cross-platform Seq release later this year, but already there's a lot of functionality that can be used seamlessly with Seq 4.2. We'd love to have your feedback and suggestions over on the project site!

nblumhardt

Read more posts by this author.