1. 6

    This is my first real blog post and it probably has some errors. This was also made before the release of the Native Journal Protocol spec which has more authoritative information and a few things I missed. (I’m posting as a comment as I’m not entirely sure if this fits in the text field, this is also my first post on lobste.rs IIRC)

    1. 4

      Great post! Journald is one of those great advantages that come with some of the costs of systemd. The fact that no libraries are needed to write to it and you just need to print to stdout feels so natural to me.

      Are you planning on doing a follow-up post with how to get things out of journald? You had some great journalctl commands in there and there’s so much more that it can do than just mimicking a syslog-grep.

      1. 2

        Thanks! I don’t have any plans for that but it sounds like a great idea. I really need to learn a lot more about journalctl. I actually wrote this to help me understand what I need to do for my WIP journald “rewrite it in rust” side project. Unfortunately it’s been sidetracked because of work.

    1. 10

      I definately agree. As a security engineer it took me more that a day to setup git-send-email with my password stored encrypted. Even getting it to connect to the mail server (fastmail) was challenging because of poor documentation on TLS vs STARTTLS. I know many skilled programmers who wouldn’t bother setting this up to submit a patch, ever if they had already written it.

      1. 1

        Nice! I’ve had to write a lot of these functions for a project I’m working on so it’ll be convenient to use this in the future.

        Just a note: I got a panic when I tried to get the window manager (I use sway on NixOS). Returning an io::Result for nixinfo::environment() and an Option for nixinfo::env() could work a lot better, especially for headless or strange systems.

        1. 2

          Thanks!

          Returning a Result<String> was actually the next thing I had listed for nixinfo. :)

          And I’ll look into Option. I’ve never worked with Options before and this crate was the first time I really started working with Result.

          Thanks for the note.

          Edit: Result<String> and Option<String> have been implemented for environment() and env() respectively.

        1. 2

          Adding tracing to a Rust project. My partner and I have spent a long time rewriting our bar command (for i3/compatible WMs) in Rust with tokio and I want to be able to debug what’s taking time.

          I also might try to get the build.rs to work better with NixOS (maybe add an option to grab libdbus from nix-build '<nixpkgs>' instead of pkg-config) but I don’t know how to do build.rs things, especially since it seems like I’d have to override some arguments to a dependency (dbus-sys)