How to monitor baby fleming vaults with logtail

logtail is a logfile monitoring tool I made while Learning Rust and which I’m developing for vault monitoring as vdash. Until vdash is useful though, you can monitor local vaults using logtail.

Example - to monitor baby-fleming vaults:

logtail ~/.safe/vault/baby-fleming-vaults/*/safe_vault.log

Get logtail

1 Install Rust via Installation - The Cargo Book

2a Install on Linux/MacOS:

cargo install logtail
logtail --help

2b On Windows you must install logtail-crossterm:

cargo install logtail --bin logtail-crossterm --features="crossterm"
logtail-crossterm --help

Then:

logtail-crossterm ~/.safe/vault/baby-fleming-vaults/*/safe_vault.log

If you want to follow or help with vdash development see the README for plans and progress.

14 Likes

You are amazing as always. I hope you have some nice things to eat and drink for the weekend, you deserve it.

4 Likes

The above instructions didn’t work for me on Windows. Seems to be the same error as previously. I’ll try from the Git repo a bit later.

Summary
$ cargo install logtail --bin logtail-crossterm --features="crossterm"
    Updating crates.io index
  Downloaded logtail v0.2.2
  Downloaded 1 crate (27.4 KB) in 6.80s
  Installing logtail v0.2.2
  Downloaded autocfg v1.0.1
  Downloaded once_cell v1.4.1
  Downloaded libc v0.2.76
  Downloaded 3 crates (543.8 KB) in 7.62s
   Compiling proc-macro2 v1.0.19
   Compiling winapi v0.3.9
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.38
   Compiling cfg-if v0.1.10
   Compiling version_check v0.9.2
   Compiling bitflags v1.2.1
   Compiling lazy_static v1.4.0
   Compiling pin-project-internal v0.4.23
   Compiling memchr v2.3.3
   Compiling proc-macro-nested v0.1.6
   Compiling futures-core v0.3.5
   Compiling libc v0.2.76
   Compiling autocfg v1.0.1
   Compiling getrandom v0.1.14
   Compiling once_cell v1.4.1
   Compiling futures-sink v0.3.5
   Compiling proc-macro-hack v0.5.18
   Compiling slab v0.4.2
   Compiling smallvec v1.4.2
   Compiling unicode-segmentation v1.6.0
   Compiling scopeguard v1.1.0
   Compiling pin-utils v0.1.0
   Compiling unicode-width v0.1.8
   Compiling futures-io v0.3.5
   Compiling strsim v0.8.0
   Compiling pin-project-lite v0.1.7
   Compiling fnv v1.0.7
   Compiling bytes v0.5.6
   Compiling vec_map v0.8.2
   Compiling anymap v0.12.1
   Compiling ppv-lite86 v0.2.9
   Compiling numtoa v0.1.0
   Compiling cassowary v0.3.0
   Compiling futures-channel v0.3.5
   Compiling futures-task v0.3.5
   Compiling lock_api v0.3.4
   Compiling textwrap v0.11.0
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling heck v0.3.1
   Compiling crossbeam-utils v0.7.2
   Compiling rand_core v0.5.1
   Compiling termion v1.5.5
   Compiling quote v1.0.7
error[E0433]: failed to resolve: maybe a missing crate `sys`?
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\lib.rs:24:9
   |
24 | pub use sys::size::terminal_size;
   |         ^^^ maybe a missing crate `sys`?

error[E0433]: failed to resolve: maybe a missing crate `sys`?
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\lib.rs:27:9
   |
27 | pub use sys::tty::{is_tty, get_tty};
   |         ^^^ maybe a missing crate `sys`?

error[E0433]: failed to resolve: maybe a missing crate `sys`?
 --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\async.rs:5:5
  |
5 | use sys::tty::get_tty;
  |     ^^^ maybe a missing crate `sys`?

error[E0433]: failed to resolve: maybe a missing crate `sys`?
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:29:5
   |
29 | use sys::attr::{get_terminal_attr, raw_terminal_attr, set_terminal_attr};
   |     ^^^ maybe a missing crate `sys`?

error[E0432]: unresolved import `sys`
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:28:5
   |
28 | use sys::Termios;
   |     ^^^ maybe a missing crate `sys`?

error[E0425]: cannot find function `get_tty` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\async.rs:14:36
   |
14 |     thread::spawn(move || for i in get_tty().unwrap().bytes() {
   |                                    ^^^^^^^ not found in this scope

error[E0425]: cannot find function `get_tty` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\async.rs:43:36
   |
43 |     thread::spawn(move || for i in get_tty().unwrap().bytes() {
   |                                    ^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:45:9
   |
45 |         set_terminal_attr(&self.prev_ios).unwrap();
   |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `get_terminal_attr` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:90:23
   |
90 |         let mut ios = get_terminal_attr()?;
   |                       ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `raw_terminal_attr` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:93:9
   |
93 |         raw_terminal_attr(&mut ios);
   |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:95:9
   |
95 |         set_terminal_attr(&ios)?;
   |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
   --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:107:9
    |
107 |         set_terminal_attr(&self.prev_ios)?;
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `get_terminal_attr` in this scope
   --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:113:23
    |
113 |         let mut ios = get_terminal_attr()?;
    |                       ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `raw_terminal_attr` in this scope
   --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:114:9
    |
114 |         raw_terminal_attr(&mut ios);
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
   --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:115:9
    |
115 |         set_terminal_attr(&ios)?;
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

error: aborting due to 15 previous errors

Some errors have detailed explanations: E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `termion`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `logtail v0.2.2`, intermediate artifacts can be found at `C:\Users\John\AppData\Local\Temp\cargo-installIwMIXk`

Caused by:
  build failed
3 Likes

Thanks John, I may have forgotten something that I did to the windows10 branch. I’ll have a look too. Please try with ‘master’ and let me know what happens.

1 Like

OK, imported the repo again - it works fine with the Windows10 branch but if I don’t git checkout windows10 it fails with that same error.

1 Like

Thanks John. I know what the issue is but don’t know how to fix it so can have some peace for a bit :wink:

2 Likes

I’m working with the local run-baby-fleming --testing vaults, is there anyway to make them persistent after restarting my server? I give out safe-url addresses for the @SafeNetworkWallet_bot but when the server restarts I have to re-run safe vault run-baby-fleming --testing because the vaults processes are terminated and the state is basically reset. The users have to reinitialize again to get new keys which I don’t like and was hoping there is an option for persistent test vaults?

You seem to know a lot about Rust and the process so I thought maybe you can help me out with this question.

Cool logtail by the way, I will install it now! :smiley:

2 Likes

For Linux, also note you need build-essential for compiler

I know very little about Rust at present and even less about vaults unfortunately, so I don’t know if you can restart without init, but I doubt it at this point as I think it would need extra code that is not required yet.

Thanks, which distro are you on? Glad you like logtail, I’m very pleased with it as a first Rust app even though all I’ve done so far is glued linemux and tui-rs together and created a simple TUI using the latter. I’m now going to start parsing the lines and gather some metrics to make a vault dashboard (vdash).

For such a complex language I’m finding the Learning Rust experience relatively easy and a lot of fun. Great tooling, very helpful compiler messages, superb community with official and unofficial support channels on Discord and Discourse forum. If you or anyone is tempted come on in, the code is lovely! :swimming_man:

4 Likes

I’m normall using Ubuntu 18.04 LTS for server.

2 Likes

Hi John, I have fix which is a bit ugly until they fix a bug in the cargo dependency selection, so it requires use of the nightly compiler. Please try ‘master’ branch as follows and let me know:

git clone https://github.com/theWebalyst/logtail-dash
cd logtail-dash
cargo +nightly build -Z features=itarget --bin logtail-crossterm --release

./target/release/logtail-crossterm --help

@DeusNexus thanks for the ‘build-essential’ thing, have added it to the README.

Still fails I’m afraid…

Summary
$ cargo +nightly build -Z features=itarget --bin logtail-crossterm --release
  Downloaded redox_syscall v0.1.57
  Downloaded 1 crate (17.1 KB) in 6.07s
  Downloaded redox_termios v0.1.1
  Downloaded 1 crate (3.2 KB) in 0.17s
  Downloaded mio v0.7.0
  Downloaded 1 crate (88.8 KB) in 2.33s
  Downloaded signal-hook v0.1.16
  Downloaded 1 crate (27.2 KB) in 0.55s
  Downloaded winapi-i686-pc-windows-gnu v0.4.0
  Downloaded 1 crate (2.9 MB) in 11.75s
  Downloaded winapi-x86_64-pc-windows-gnu v0.4.0
  Downloaded 1 crate (2.9 MB) in 11.69s
  Downloaded cloudabi v0.0.3
  Downloaded 1 crate (22.2 KB) in 0.45s
  Downloaded fsevent v2.0.2
  Downloaded 1 crate (11.3 KB) in 0.49s
  Downloaded fsevent-sys v3.0.2
  Downloaded 1 crate (4.2 KB) in 0.38s
  Downloaded inotify v0.8.3
  Downloaded 1 crate (21.9 KB) in 0.30s
  Downloaded mio v0.6.22
  Downloaded 1 crate (102.8 KB) in 0.77s
  Downloaded mio-extras v2.0.6
  Downloaded 1 crate (16.3 KB) in 0.49s
  Downloaded rand_hc v0.2.0
  Downloaded 1 crate (11.7 KB) in 0.20s
  Downloaded wasi v0.9.0+wasi-snapshot-preview1
  Downloaded 1 crate (31.5 KB) in 0.26s
  Downloaded ansi_term v0.11.0
  Downloaded 1 crate (17.1 KB) in 0.55s
  Downloaded hermit-abi v0.1.15
  Downloaded 1 crate (9.6 KB) in 0.44s
   Compiling proc-macro2 v1.0.19
   Compiling unicode-xid v0.2.1
   Compiling winapi v0.3.9
   Compiling syn v1.0.38
   Compiling cfg-if v0.1.10
   Compiling bitflags v1.2.1
   Compiling version_check v0.9.2
   Compiling memchr v2.3.3
   Compiling lazy_static v1.4.0
   Compiling pin-project-internal v0.4.23
   Compiling proc-macro-nested v0.1.6
   Compiling autocfg v1.0.0
   Compiling futures-core v0.3.5
   Compiling getrandom v0.1.14
   Compiling once_cell v1.4.0
   Compiling futures-sink v0.3.5
   Compiling libc v0.2.74
   Compiling proc-macro-hack v0.5.18
   Compiling slab v0.4.2
   Compiling unicode-width v0.1.8
   Compiling futures-io v0.3.5
   Compiling scopeguard v1.1.0
   Compiling smallvec v1.4.2
   Compiling pin-utils v0.1.0
   Compiling unicode-segmentation v1.6.0
   Compiling bytes v0.5.6
   Compiling strsim v0.8.0
   Compiling pin-project-lite v0.1.7
   Compiling anymap v0.12.1
   Compiling fnv v1.0.7
   Compiling vec_map v0.8.2
   Compiling ppv-lite86 v0.2.8
   Compiling cassowary v0.3.0
   Compiling numtoa v0.1.0
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling futures-channel v0.3.5
   Compiling futures-task v0.3.5
   Compiling textwrap v0.11.0
   Compiling lock_api v0.3.4
   Compiling crossbeam-utils v0.7.2
   Compiling heck v0.3.1
   Compiling quote v1.0.7
   Compiling termion v1.5.5
   Compiling rand_core v0.5.1
error[E0433]: failed to resolve: unresolved import
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\lib.rs:24:9
   |
24 | pub use sys::size::terminal_size;
   |         ^^^
   |         |
   |         unresolved import
   |         help: a similar path exists: `color::env::sys`

error[E0433]: failed to resolve: unresolved import
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\lib.rs:27:9
   |
27 | pub use sys::tty::{is_tty, get_tty};
   |         ^^^
   |         |
   |         unresolved import
   |         help: a similar path exists: `color::env::sys`

error[E0433]: failed to resolve: unresolved import
 --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\async.rs:5:5
  |
5 | use sys::tty::get_tty;
  |     ^^^
  |     |
  |     unresolved import
  |     help: a similar path exists: `color::env::sys`

error[E0433]: failed to resolve: unresolved import
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:29:5
   |
29 | use sys::attr::{get_terminal_attr, raw_terminal_attr, set_terminal_attr};
   |     ^^^
   |     |
   |     unresolved import
   |     help: a similar path exists: `color::env::sys`

error[E0432]: unresolved import `sys`
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:28:5
   |
28 | use sys::Termios;
   |     ^^^
   |     |
   |     unresolved import
   |     help: a similar path exists: `color::env::sys`

error[E0425]: cannot find function `get_tty` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\async.rs:14:36
   |
14 |     thread::spawn(move || for i in get_tty().unwrap().bytes() {
   |                                    ^^^^^^^ not found in this scope

error[E0425]: cannot find function `get_tty` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\async.rs:43:36
   |
43 |     thread::spawn(move || for i in get_tty().unwrap().bytes() {
   |                                    ^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:45:9
   |
45 |         set_terminal_attr(&self.prev_ios).unwrap();
   |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `get_terminal_attr` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:90:23
   |
90 |         let mut ios = get_terminal_attr()?;
   |                       ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `raw_terminal_attr` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:93:9
   |
93 |         raw_terminal_attr(&mut ios);
   |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
  --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:95:9
   |
95 |         set_terminal_attr(&ios)?;
   |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
   --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:107:9
    |
107 |         set_terminal_attr(&self.prev_ios)?;
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `get_terminal_attr` in this scope
   --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:113:23
    |
113 |         let mut ios = get_terminal_attr()?;
    |                       ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `raw_terminal_attr` in this scope
   --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:114:9
    |
114 |         raw_terminal_attr(&mut ios);
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
   --> C:\Users\John\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.5\src\raw.rs:115:9
    |
115 |         set_terminal_attr(&ios)?;
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

   Compiling rand_chacha v0.2.2
error: aborting due to 15 previous errors

Some errors have detailed explanations: E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `termion`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

Thanks John, please try:

cargo +nightly build -Z features=itarget --bin logtail-crossterm --release --no-default-features

This works!

$ cargo +nightly build -Z features=itarget --bin logtail-crossterm --release --no-default-features --features="crossterm"

1 Like

Thanks very much John. I’ll add that to the README. AFAIK logtail now works on Linux and Windows. It does build on MacOS, the author of linemux has been helping there but he reports that the updates don’t make it to the display so it’s nearly there for basic functionality. Meanwhile I’m about to start parsing vault logs to gather metrics (in vdash, the vault version of logtail).

1 Like

Excellent - I had to install nightly btw - may be worth adding to the README if that’s going to be a requirement for a while rustup toolchain install nightly

1 Like

Yes good point I’ll add that. Thanks again.