/logdy-core

Web based real-time log viewer. Stream ANY content to a web UI with autogenerated filters. Parse any format with TypeScript.

Primary LanguageGoApache License 2.0Apache-2.0

Logdy - terminal logs in web browser

Webpage | Demo | Docs | Download | Blog

Latest version: 0.13 (10 July 2024) - Read announcement

Logdy is a single-binary that you add to your PATH so it's available just like any other tool: grep, awk, sed, jq. No installations, no deployments, no compilations. It works locally, so it's also secure. Read more.

Standalone use

# use with any shell command
$ tail -f file.log | logdy
INFO[2024-02...] WebUI started, visit http://localhost:8080    port=8080

Use as a Go library

package main

import "github.com/logdyhq/logdy-core/logdy"

func main(){
  logdyLogger := logdy.InitializeLogdy(logdy.Config{
    ServerIp:       "127.0.0.1",
    ServerPort:     "8080",
  }, nil)
  logdyLogger.LogString("Log message")
  <-context.Background().Done()
}

Demo

Visit demo.logdy.dev

autogenerate

Visit logdy.dev for more info.

Project status: Beta version, new features added actively.

Logdy is under heavy development and a lot of features is yet to be added. A feedback is welcome from early adopters. Feel free to post Issues, Pull Requests and contribute in the Discussions. Stay tuned for updates, visit Logdy Blog.

Install using script

The command below will download the latest release and add the executable to your system's PATH. You can also use it to update Logdy.

$ curl https://logdy.dev/install.sh | sh

Install with Homebrew (MacOS)

On MacOS you can use homebrew to install Logdy.

$ brew install logdy

Download precompiled binary

Naviage to releases Github page and download the latest release for your architecture.

wget https://github.com/logdyhq/logdy-core/releases/download/v0.12.0/logdy_linux_amd64;
mv logdy_linux_amd64 logdy;
chmod +x logdy;

In addition you can add the binary to your PATH for easier access.

Quick start

Whatever the below command will produce to the output, will be forwarded to a Web UI.

node index.js | logdy

The following should appear

INFO[2024-02...] WebUI started, visit http://localhost:8080    port=8080

Open the URL Address and start building parsers, columns and filters.

There are multiple other ways you can run Logdy, check the docs.

Install Go library

$ go get -u github.com/logdyhq/logdy-core/logdy

Read more about how to use Logdy embedded into your Go app.

Documentation

For product documentation navigate to the official docs.

CLI Usage

Usage:
  logdy [command] [flags]
  logdy [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  demo        Starts a demo mode, random logs will be produced, the [number] defines a number of messages produced per second
  follow      Follows lines added to files. Example `logdy follow foo.log /var/log/bar.log`
  forward     Forwards the STDIN to a specified port, example `tail -f file.log | logdy forward 8123`
  help        Help about any command
  socket      Sets up a port to listen on for incoming log messages. Example `logdy socket 8233`. You can setup multiple ports `logdy socket 8123 8124 8125`
  stdin       Listens to STDOUT/STDERR of a provided command. Example `logdy stdin "npm run dev"`
  utils       A set of utility commands that help working with large files

Flags:
      --append-to-file string         Path to a file where message logs will be appended, the file will be created if it doesn't exist
      --append-to-file-raw            When 'append-to-file' is set, raw lines without metadata will be saved to a file
      --bulk-window int               A time window during which log messages are gathered and send in a bulk to a client. Decreasing this window will improve the 'real-time' feeling of messages presented on the screen but could decrease UI performance (default 100)
      --config string                 Path to a file where a config (json) for the UI is located
      --disable-ansi-code-stripping   Use this flag to disable Logdy from stripping ANSI sequence codes
  -t, --fallthrough                   Will fallthrough all of the stdin received to the terminal as is (will display incoming messages)
  -h, --help                          help for logdy
      --max-message-count int         Max number of messages that will be stored in a buffer for further retrieval. On buffer overflow, oldest messages will be removed. (default 100000)
  -n, --no-analytics                  Opt-out from sending anonymous analytical data that helps improve Logdy
  -u, --no-updates                    Opt-out from checking updates on program startup
  -p, --port string                   Port on which the Web UI will be served (default "8080")
      --ui-ip string                  Bind Web UI server to a specific IP address (default "127.0.0.1")
      --ui-pass string                Password that will be used to authenticate in the UI
  -v, --verbose                       Verbose logs
      --version                       version for logdy

Development

For development, we recommend running demo mode

go run . demo 1

The above command will start Logdy in demo mode with 1 log message produced per second. You can read more about demo mode.

If you would like to develop with UI, check readme for logdy-ui for instructions how to run both together during development.

Building

This repository uses static asset embedding during compilation. This way, the UI is served from a single binary. Before you build make sure you copy a compiled UI (follow the instructions about building) in assets directory. The UI is already commited to this repository, so you don't have to do anymore actions.

Look at embed.go for more details on how UI is embedded into the binary.

For a local architecture build:

go build

Releasing

For a cross architecture build use gox. This will generate multiple binaries (in bin/ dir) for specific architectures, don't forget to update main.Version tag.

gox \
    -ldflags "-X 'main.Version=x.x.x'" \
    -output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}" \
    -osarch="linux/amd64 windows/386 windows/amd64 darwin/amd64 darwin/arm64 linux/arm64"

Once it's ready, publish the binaries in a new Github release. Again, don't forget to update the version.

ghr vx.x.x bin/