Skip to content

How to's?

How to add Logdy to PATH?

Step 1: Copy the Binary to a Directory in PATH

Assuming you have the "logdy" binary located at /path/to/logdy, let's copy it to /usr/local/bin:

bash
sudo cp /path/to/logdy /usr/local/bin/

Step 2: Verify the Binary is in PATH

Check if the directory is in your PATH:

bash
echo $PATH

Ensure that /usr/local/bin is listed in the output. If not, proceed to adding it.

Step 3: Make the Binary Executable (if necessary)

If "logdy" is not already executable, make it executable:

bash
sudo chmod +x /usr/local/bin/logdy

Step 3.1 (only for MacOS):

On MacOS you may need to pull the binary out of quarantine by removing an extended attribute with a command in CLI

$ xattr -d com.apple.quarantine /path/to/binary

This will prevent rejecting Logdy by MacOS system with an error like below:

Step 4: Test the Binary

Open a new terminal or run:

bash
$ source ~/.bashrc

Now, you should be able to run "logdy" from any location:

bash
$ logdy
  • The use of sudo is required when copying to system directories like /usr/local/bin.
  • The chmod +x command makes the binary executable.
  • The source command is used to apply changes to the current terminal session.
  • Make sure to replace /path/to/logdy with the actual path to your "logdy" binary.

How to tail a file?

You can tail an existing file

bash
$ tail -f file.log | logdy
# OR
$ logdy follow file.log
# OR
$ logdy stdin 'tail -f file.log'

In the above example the result will be the same.

How to tail multiple files?

follow mode

We have a dedicated mode for that:

bash
$ logdy follow file1.log file2.log

forward and socket mode

It's also possible with socket and forward modes:

bash
# setup a listening instance
$ logdy socket 8123 8124 8125

# follow new lines in 3 distinct files and forward them to specific ports
$ tail -f log1.log | logdy forward 8123
$ tail -f log2.log | logdy forward 8124
$ tail -f log3.log | logdy forward 8125

The example above allows you to define exactly which logs are coming from which port thanks to origin.port property available in the Message type.

How to capture the output of multiple processes?

Just use socket and forward modes. The below setup will combine the output of each process in the central place (logdy socket instance). In the UI you will be able to differentiate messages based on the port they came from.

bash
# setup a listening instance
$ logdy socket 8123 8124 8125

# forward stdout to a respective port
$ node app.js | logdy forward 8123
$ python script.py | logdy forward 8124
$ go run main.go | logdy forward 8125

How to attach to STDOUT/STDERR of a running process?

WARNING

This works on Linux only

Assuming that you have a PID (process ID) at hand that you wish to listen to, just simply use tail -f command on /proc/<PID>/fd/1 to listen to STDERR.

Full example would be, assuming our PID is 9841

bash
$ logdy stdin 'tail -f /proc/9841/fd/1'

For listending STDERR use 2 like so /proc/<PID>/fd/2. Listening to both STDOUT and STDERR of a same process can be handled with

bash
$ logdy stdin 'tail -f /proc/9841/fd/1 /proc/9841/fd/2'

Keep in mind that for the above command you have to setup a filtering on lines that are produced when tail changes the file context.

Using Logdy with NPM and live-reload

This could not been easier, Logdy can trace running your app with NPM and supports live reloading too!

bash
$ logdy stdin 'npm run dev'

Tail a remote file over ssh and stream to Logdy

bash
$ ssh -t remote-server "tail -f /var/log/log.txt" | logdy