Home » How to install Logstalgia on Mac and use with ssh tunnels

How to install Logstalgia on Mac and use with ssh tunnels


If you’re not familiar with Logstalgia, it’s a really neat log visualization application that parses server logs (apache, nginx, or otherwise) into a fun Atari pong-like graphical interface. This is a tutorial on How to install Logstalgia on Mac and use with ssh tunnels. Before we get into this, let me give you a fair warning… this can be so visually appealing that if you may end up being distracted during your work day until your peripheral vision adjusts to the awesome.

Let’s get started shall we? If you are a Mac user and you haven’t installed the Homebrew package manager yet, it’s time to introduce you to it and change your life by giving your terminal the ability to install packages like you would with any other linux distribution! If you have Homebrew installed already, then feel free to skip the next step.

Since ruby ships with MacOS natively, Homebrew is ridiculously easy to install. This is copied directly from the Homebrew website:

Now that you have Homebrew installed, let’s download Logstalgia. Let’s install wget (since it’s epic and makes it fun to download things in your terminal) and download Logstalgia that way… why not right?

You now have wget installed so you can right click on the link to the latest version of Logstalgia, click “Copy Link Address” (or whatever your browser says), open up a terminal, and type something similar to what’s below. You’ll obviously want to replace the Logstalgia link in the following set of commands with the latest link to Logstalgia:

Now we need to install the Logstalgia requirements that you may not have known to install, since it’s not in their installation instructions:

Now we should be able to compile Logstalgia, which will make it available to run through an ssh tunnel, which I’ll describe in just a bit:

Alright, that’s just about it! Logstalgia is now installed and  available via the terminal. This means that we can use an ssh tunnel to read the log files of your server to pull them into your local Logstalgia application.

An ssh tunnel literally means “login and run a command on a remote server, and then take the output of that command and pipe it to an application on another computer.” In this case, we’re going to ssh into a remote server and pipe the output of our command (a command that spits out the contents of all our log files on our server) to our local Logstalgia application. I’m going to give you a few different examples of how this can be done since people often have a bunch of different paths for log files based on how they setup their virtual host configuration.

Example of running Logstalgia on a shared nginx log file. This means all your site’s logs go to the same log file… which would be the default install of nginx:

If you run Apache  instead then you can do the same command as above, but replace “nginx” with “httpd” (or “apache2” if you are on a debian/ubuntu system).

That being said, I prefer CentOS systems, and I also setup all my sites to run in their own directories with /www so they all have their own log directories and files. For my particular setup, I’ll have a bunch of sites that are in /www/somesite/logs/access.log for example. That being said, you can run a command like the one below to grab every access log on a server like mine so we can pipe it to Logstalga. This is where the power of linux really becomes fun to look at:

There’s a bunch of videos on Youtube that show you how Logstalgia looks; some of which are crazy visualization of DDoS attacks and such. Here’s an example of what this can look like with a pretty standardly busy server:

6 comments on “How to install Logstalgia on Mac and use with ssh tunnels

  1. Antani on

    Hi there,

    Thanks for this how-to, really helpful and well explained.
    Unfortunately I’ve encountered an issue during the installation.

    When I run “./configure” I get this:

    checking for FT2… configure: error: Package requirements (freetype2 >= 9.0.3) were not met:

    No package ‘freetype2’ found

    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.

    Alternatively, you may set the environment variables FT2_CFLAGS
    and FT2_LIBS to avoid the need to call pkg-config.
    See the pkg-config man page for more details.

    Any idea how to go further please?

    Thank you. Keep the good work up.


    Antani

    Reply
    • Jeff Hays on

      Hey Antani,

      I believe this should do the trick for you:

      You’ll obviously want to repeat the step that threw the error after doing this. Let me know if this doesn’t seem to work out.

      Cheers

      Reply
  2. Antani on

    Hi Jeff,

    Thanks for your quick reply. I’ve bypassed that issue installing logstalgia straight from brew.

    Now I have another issue.

    I’m trying to get the logs from another machine, using ssh as you described:
    ssh username@myserver -p 300 “tail -f /path_to_my/access.log” | logstalgia –sync

    but I can’t get anything on logstalgia. Do you think that having ssh mapped to port 300 could be the issue?

    Thank you.


    Antani

    Reply
    • Jeff Hays on

      Thanks for this Michael. I have added this to the tutorial itself (if it’s already installed like it was for me, then it won’t hurt to include it in the install command). Cheers.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *