MCPcopy
hub / github.com/NarrativeScience-old/log.io

github.com/NarrativeScience-old/log.io @v0.4.16 sqlite

repository ↗ · DeepWiki ↗ · release v0.4.16 ↗
72 symbols 145 edges 33 files 11 documented · 15%
README

Log.io - Real-time log monitoring in your browser

Powered by node.js + socket.io

License Version Node

How does it work?

A file input watches log files for changes, sends new messages to the server via TCP, which broadcasts to browsers via socket.io.

Users can watch adhoc log streams by activating inputs and binding them to multiple screens via the web UI.

Terminology

Stream - A logical designation for a group of messages that relate to one another. Examples include an application name, a topic name, or a backend service name.

Source - A physical designation for a group of messages that originate from the same source. Examples include a server name, a service provider name, or a filename.

Input - A (stream, source) pair.

While originally designed to represent backend service logs spread across multiple servers, the stream/source abstraction is intentionally open-ended to allow users to define a system topology for their specific use case.

Install & run server

Install via npm

npm install -g log.io

Configure hosts & ports (see example below)

nano ~/.log.io/server.json

Run server

log.io-server

Browse to http://localhost:6688

Install & run file input

Install via npm

npm install -g log.io-file-input

Configure file input (see example below)

nano ~/.log.io/inputs/file.json

Run file input

log.io-file-input

Server configuration

There are two servers: the message server, which receives TCP messages from message inputs, and the HTTP server, which receives requests from browsers. By default, the application looks for configuration in ~/.log.io/server.json, and can be overridden with the environment variable LOGIO_SERVER_CONFIG_PATH.

Sample configuration file:

{
  "messageServer": {
    "port": 6689,
    "host": "127.0.0.1"
  },
  "httpServer": {
    "port": 6688,
    "host": "127.0.0.1"
  },
  "debug": false,
  "basicAuth": {
    "realm": "abc123xyz",
    "users": {
      "username1": "password1"
    }
  }
}

basicAuth and debug are both optional keys that can be omitted.

File input configuration

Inputs are created by associating file paths with stream and source names in a configuration file. By default, the file input looks for configuration in ~/.log.io/inputs/file.json, and can be overridden with the environment variable LOGIO_FILE_INPUT_CONFIG_PATH.

Input paths can be a file path, directory path or a glob. Additionally, watcher options can be provided for more fine-grained control over file watching mechanics and performance. See the chokidar documentation for more information.

Sample configuration file:

{
  "messageServer": {
    "host": "127.0.0.1",
    "port": 6689
  },
  "inputs": [
    {
      "source": "server1",
      "stream": "app1",
      "config": {
        "path": "log.io-demo/file-generator/app1-server1.log"
      }
    },
    {
      "source": "server2",
      "stream": "system-logs",
      "config": {
        "path": "/var/log/**/*.log",
        "watcherOptions": {
          "ignored": "*.txt",
          "depth": 99,
        }
      }
    }
  ]
}

Server TCP interface

The file input connects to the server via TCP, and writes properly formatted strings to the socket. Custom inputs can send messages to the server using the following commands, each of which ends with a null character:

Send a log message

+msg|streamName1|sourceName1|this is log message\0

Register a new input

+input|streamName1|sourceName1\0

Remove an existing input

-input|streamName1|sourceName1\0

Extension points exported contracts — how you extend this code

ScreenManagerProps (Interface)
(no doc)
ui/src/components/screens/index.tsx
MappedScreenManagerProps (Interface)
(no doc)
ui/src/components/screens/index.tsx
ScreenProps (Interface)
(no doc)
ui/src/components/screens/index.tsx
ScreenMessageProps (Interface)
(no doc)
ui/src/components/screens/index.tsx
AppProps (Interface)
(no doc)
ui/src/components/app/index.tsx

Core symbols most depended-on inside this repo

sendUnbindInput
called by 4
ui/src/socket/index.ts
bindInputToScreen
called by 3
ui/src/reducers/bindings/index.ts
unbindInputFromScreen
called by 3
ui/src/reducers/bindings/index.ts
sendBindInput
called by 3
ui/src/socket/index.ts
getInputName
called by 2
server/src/inputs.ts
add
called by 2
server/src/inputs.ts
initializeState
called by 2
ui/src/reducers/index.ts
checkStreamBinding
called by 2
ui/src/reducers/bindings/index.ts

Shape

Function 52
Interface 14
Method 4
Class 2

Languages

TypeScript100%

Modules by API surface

ui/src/socket/index.ts11 symbols
ui/src/components/screens/index.tsx10 symbols
ui/src/components/inputs/index.tsx7 symbols
server/src/inputs.ts7 symbols
ui/src/components/inputs/controls.tsx6 symbols
server/src/server.ts5 symbols
inputs/file/src/input.ts5 symbols
ui/src/reducers/bindings/index.ts4 symbols
ui/src/socket/types.ts3 symbols
ui/src/reducers/index.ts2 symbols
ui/src/components/app/index.tsx2 symbols
ui/src/reducers/screens/index.ts1 symbols

Dependencies from manifests, versioned

@babel/cli7.8.4 · 1×
@babel/core7.8.7 · 1×
@babel/plugin-proposal-class-properties7.8.3 · 1×
@babel/plugin-proposal-numeric-separator7.8.3 · 1×
@babel/plugin-proposal-object-rest-spread7.8.3 · 1×
@babel/plugin-transform-runtime7.8.3 · 1×
@babel/preset-env7.8.7 · 1×
@babel/preset-typescript7.8.3 · 1×
@babel/runtime7.8.7 · 1×
@testing-library/react9.4.0 · 1×
@testing-library/user-event7.2.1 · 1×

For agents

$ claude mcp add log.io \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact