Deploying Logshare with Compose and Bluemix


Deploy your own logshare server using Compose and Bluemix

I tend to develop locally, running Node.js code on my machine from the terminal. I can tail a log file locally and see the output data stream from top to bottom:

> tail -f /var/log/system.log

But how could I share this output with my co-workers? There are several unsatisfactory options:

So, I came up with a simple solution: logshare. It's a Node.js app that you can install via npm:

> npm install -g logshare

And then, when you pipe streaming content to it, it issues a URL you can share with your co-workers:

> tail -f /var/log/system.log | logshare
Share URL:  

Your co-workers can watch the logs go by on a web page, or they too can install logshare and view the logs on their console with:

> logshare kkdgapgdx

where kkdgapgdx is the unique token issued to each logshare session.


You can read about how logshare is constructed here.

How does logshare work?

Logshare consists of two components:


Redis handles one pubsub channel per data stream with data fed between the client and server via a combination of RESTful APIs and WebSockets connections.

In my deployment, I use IBM Bluemix to host the server-side code and Compose to provide the Redis service. By default, the command-line utility uses my logshare deployment at, but you can install your own instance of logshare and run your own setup.

Install your own logshare server

Step 1 - Deploy to Bluemix

Go to the bottom of the logshare-server Github page and click the handy Deploy to Bluemix button. If you don't already have a Bluemix account, you're prompted to sign up.

Step 2 - Create Redis instance on Compose

The app can't run without a Redis database, so Sign up for a Compose account and click Create Deployment.


You can select your Redis cluster location at this point; I picked SoftLayer Dallas because that's where my Bluemix account is based too. It's best for performance to have your app server and database close. Within a minute or so, your deployment is ready.

With your Redis deployment open in Compose, click the Overview tab. Under Credentials, hit the show link to see your password. Then scroll down the page and note the domain name and port number. These credentials let you connect to the Redis cluster.


Step 3 - Configure Bluemix

In your Bluemix dashboard, click Add a Service or API and choose Redis by Compose. Then configure the service, entering the password, domain name, and port you copied in Step 2. Although the service prompts for a username, you can enter an x in this field.

The service restarts, and your logshare instance should be up and running!

The logshare client

By default, the logshare-client is configured to communicate with my logshare instance at, but you can override this by setting an environment variable LOGSHARE that contains the URL of your service on Bluemix, e.g.

> export LOGSHARE=
> tail -f logs.txt | logshare
Share URL:  

Why would you want your own logshare server?

You could just use the default logshare server for your work, but if you want control of your own destiny and you want your data to flow through to your server, then you are better off creating your own instance.

One logshare user recently suggested that logshare could keep its channel open at the end of a session (currently the channel is deleted). This would let several application servers continually spool their data to static channel names:

> tail -f /var/log/apache.log | logshare server1

And the sysadmins could tail any logs they liked by knowing the channel names. It would require a small change to the code, but PRs are always welcome!

Glynn Bird
Glynn Bird - Developer Advocate for IBM Cloud Data Services. Follow Glynn at Love this article? Head over to Glynn Bird’s author page to keep reading.

Conquer the Data Layer

Spend your time developing apps, not managing databases.