Hacker Newsnew | past | comments | ask | show | jobs | submit | more tstack's commentslogin

The Logfile Navigator (https://lnav.org) is a log file viewer/merger/tailer for the terminal. It has some advanced UX features, like showing previews of operations and displaying context sensitive help. For example, the preview for filtering out logs by regex is to highlight the lines that will be hidden in red. This can make crafting the right regex a bit easier since the preview updates as you type. lnav also has some simple bar charting abilities, so you can visualize the results of SQL queries made against the log messages.


Hah, I just started reading The Story of Diva and Flea[1] to my 5-year-old and "Flea" describes himself as a Flâneur. Still trying to figure out the right way to pronounce it...

[1] - https://en.wikipedia.org/wiki/The_Story_of_Diva_and_Flea


The "fla" is pronounced with french a sound, as in "ah". The "eur" sound as in "murder"



> As much as I love terminal, its just so limiting when it comes to browsing and filtering through more content.

What terminal-based tools are you thinking of when you say this? Just tail/grep/less?


that and more magic of sed, awk, jq and similar. I know you can do real magic in there but still, I believe it's easier to learn GUI than vim shortcuts or sophisticated jq/awk formulas. Still, I admire terminal for being around for so long and follow it as an example when building Logdy.


> Looks like PRQL doesn't have a Go library so I guess they just really wanted something in Go?

There's some C bindings and the example in the README shows integration with Go:

https://github.com/PRQL/prql/tree/main/prqlc/bindings/prqlc-...


Ah yeah I wonder why they don't mention that in their docs.


The Logfile Navigator (https://lnav.org) - A logfile viewer for the terminal. Have used it just about every work day for the past decade and a half.


Nice. I've used this before.


A Closed and Common Orbit by Becky Chambers.


I also wish for a rust replacement of lnav! (I'm the author)

I actually started working on one earlier this year and made some progress before getting distracted. I was using tui-rs, which then got forked to ratatui. I should check back in with it sometime soon.


As it happens, I'm one of the maintainers of Ratatui, so it's been a little bit more than an idle thought... If you do happen to find time to revive the project I'd be happy to help. Come say hi on the ratatui discord / matrix.


Did you run into any huge roadblocks when you were trying to port the C++ codebase? I've really been digging `lnav` for the last few days - it gives me a sizeable fraction of Datadog's power in my tiny new embedded world.


Yes, there were some roadblocks and that made me lose some steam. What's kinda funny is that I spent a lot of time trying to make pretty errors[1] in lnav as inspired by rustc, but had a hard time replicating that in the rust ecosystem. For example, I was using serde to parse lnav's JSON configuration files, but getting serde to report line numbers (and/or a JSON path) for errors was pretty difficult. I think serde was also missing a way to report multiple errors.

Otherwise, I had wanted to do some rearchitecting to do log parsing in background threads since it's largely sync in the C++ version. Doing that in rust was great since the borrow-checker guided me down a sane path.

[1] - https://lnav.org/2022/08/04/pretty-errors.html


I've been meaning to have a play with miette for a while:

    fn main() -> Result<()> {
        let config: Config = serde_json::from_str(DATA).map_err(|e| BadJson::from_json_err(e, DATA))?;
        Ok(())
    }

    #[derive(Debug, Error, Diagnostic)]
    #[error("Received some unexpected JSON.")]
    #[diagnostic(
        code(some::app::bad_json),
        url("https://my-app.com/some-json-error"),
        help("Fix the JSON.",)
    )]
    struct BadJson {
        source: serde_json::Error,
        #[source_code]
        json: NamedSource,
        #[label("here")]
        err_loc: (usize, usize),
    }

    impl BadJson {
        fn from_json_err(err: serde_json::error::Error, json: &str) -> Self {
            let offset = SourceOffset::from_location(json, err.line(), err.column());
            Self {
                source: err,
                json: NamedSource::new("config.json", json.to_string()),
                err_loc: (offset.offset(), 0),
            }
        }
    }
Generates:

    Error: some::app::bad_json (https://my-app.com/some-json-error)

    × Received some unexpected JSON.
    ╰─▶ invalid type: integer `123`, expected a string at line 13 column 51
        ╭─[config.json:12:1]
    12 │                             "color": "#f6f6f6",
    13 │                             "background-color": 123
        ·                                                   ▲
        ·                                                   ╰── here
    14 │                         }
        ╰────
    help: Fix the JSON.


Yep, exactly this. I wrote a short blog post[1] announcing the playground, but didn't go into much detail. All this stuff just runs on the free-tier of fly.io since it doesn't get much traffic.

[1] - https://lnav.org/2022/09/01/playground.html


Ah! I was about to write you an email to ask some further questions, but then I saw you replied here on HN. This is excellent, thanks for doing such a good job with your ChangeBlog.


> all so that the same binary runs on multiple operating systems, which isn’t actually very useful.

I like to mention my use case when this comes up: my log file viewer (https://lnav.org) uploads an agent to remote hosts in order to tail log files on that host[1]. While lnav itself is not built using cosmo, the agent is. So, it works on multiple OSs without having to compile and include multiple versions of the agent.

[1] - https://lnav.org/2021/05/03/tailing-remote-files.html


Man oh man, how come I didn't find this tool 6 months ago? I think you need more topics/tags on the github repo :-D

Extremely cool, I will definitely check out lnav when I get a chance. I've been battling with the big players for a few months now and their systems are just so overengineered and complex for my needs that it's silly.

I just need tail -f for 10-ish servers and desktops.

I haven't even read the project readme, but I presume lnav is exactly what I wanted. Excellent!


I just wrote a similar thing. A simple CLI that posts alerts and heartbeats to Alerta. I used Go mainly for the same reason. (But I also couldn't write it in C or C++ :D)


I’d be interested in what you found difficult to use lnav, if you have a minute.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: