Skip to content

gthvn1/xapi-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

  • xapi-viewer is a TUI log viewer written in Rust (ratatui) designed for XAPI logs. Its key differentiator over lnav is one-keystroke filtering by known XAPI token types: task IDs (D:), request IDs (R:), track IDs (trackid=), UUIDs, and OpaqueRefs.

  • Note: This tool is a specialized viewer, not a general-purpose log engine. It lacks the vast majority of lnav's feature set in favor of a lightweight, hard-coded focus on XAPI token navigation.

Status

  • Currently we have a pager. We can load logs and scroll with highlights of keywords like TaskId (D:xxxx), RequestId (R:xxxx), TrackId (trackid=xxxx), Uuid (uuid:xxxx), and OpaqueRef (OpaqueRef:xxxx).
  • Filtering by keyword is supported: navigate to a match with Tab/Shift-Tab, then press Enter to toggle it as an active filter.
  • Next steps:
    • Add a filter panel to easily deselect filters
    • Cross-reference with the XAPI database
    • Use Memory-map files and build a line-offset index
    • Load multiple files
  • Run: cargo run -- samples/xensource.log 2>/tmp/debug.log
    • Use your own logs
    • It's a WIP: don't forget to redirect stderr.
  • Here is a screenshot

xapi-viewer screenshot

Setup

  • To setup the project we are using rustup from Nix, but the actual Rust toolchain lives in ~/.rustup, managed by us.
    • TODO: check rust-overlay.
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
  buildInputs = with pkgs; [
    # Rust toolchain manager
    rustup

    # Dev tools not handled by rustup
    bacon

    # Fast linker (big win)
    lld
  ];

  # Ensures rust-analyzer works properly
  RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";

  # Faster builds
  RUSTFLAGS = "-C link-arg=-fuse-ld=lld";

  # Fix rustup home so it doesn't fight with nix shells
  shellHook = ''
    export RUSTUP_HOME=$HOME/.rustup
    export CARGO_HOME=$HOME/.cargo
    export PATH=$CARGO_HOME/bin:$PATH

    echo ""
    echo "🦀 Rust dev shell (Nix + rustup)"
    echo "--------------------------------"
    echo "• rustup is provided by Nix"
    echo "• bacon is provided by Nix"
    echo ""
    echo "⚠️  You still need to install Rust tools via rustup:"
    echo "   rustup default stable"
    echo "   rustup component add rustfmt clippy rust-analyzer"
    echo ""
  '';
}

About

Inspect XAPI logs and database

Resources

License

Stars

Watchers

Forks

Contributors