<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Architecture on Jason Wilder&#39;s Blog</title>
        <generator uri="https://gohugo.io">Hugo</generator>
        <link>http://jasonwilder.com/categories/architecture/</link>
        
        <language>en-us</language>  
        <updated>Tue, 15 Jul 2014 00:00:00 UTC</updated>
        
        <item>
            <title>Docker Service Discovery Using Etcd and Haproxy</title>
            <link>http://jasonwilder.com/blog/2014/07/15/docker-service-discovery/</link>
            <pubDate>Tue, 15 Jul 2014 00:00:00 UTC</pubDate>
            
            <guid>http://jasonwilder.com/blog/2014/07/15/docker-service-discovery/</guid>
            <description>

&lt;p&gt;In a previous post, I showed a way to create an &lt;a href=&#34;http://jasonwilder.com/blog/2014/03/25/automated-nginx-reverse-proxy-for-docker/&#34;&gt;automated nginx reverse proxy&lt;/a&gt; for docker containers running on the same host.  That setup works fine for front-end web apps, but is not ideal for backend services since they are typically spread across multiple hosts.&lt;/p&gt;

&lt;p&gt;This post describes a solution to the backend service problem using service discovery for docker containers.&lt;/p&gt;

&lt;p&gt;The architecture we&amp;rsquo;ll build is modelled after &lt;a href=&#34;http://nerds.airbnb.com/smartstack-service-discovery-cloud/&#34;&gt;SmartStack&lt;/a&gt;, but uses &lt;a href=&#34;http://coreos.com/using-coreos/etcd/&#34;&gt;etcd&lt;/a&gt; instead &lt;a href=&#34;http://zookeeper.apache.org/&#34;&gt;Zookeeper&lt;/a&gt; and two docker containers running &lt;a href=&#34;https://github.com/jwilder/docker-gen&#34;&gt;docker-gen&lt;/a&gt; and &lt;a href=&#34;http://www.haproxy.org/&#34;&gt;haproxy&lt;/a&gt; instead of &lt;a href=&#34;https://github.com/airbnb/nerve&#34;&gt;nerve&lt;/a&gt; and
&lt;a href=&#34;https://github.com/airbnb/synapse&#34;&gt;synapse&lt;/a&gt; .&lt;/p&gt;

&lt;h2 id=&#34;how-it-works:5152b7114a679e7779eb00e9843508ec&#34;&gt;How It Works&lt;/h2&gt;

&lt;p&gt;&lt;img src=&#34;http://jasonwilder.com/images/docker-service-discovery.png&#34; alt=&#34;Docker Service Discovery&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Similar to SmartStack, we have components to serve as a registry (etcd), a registration side-kick process (docker-register), discovery side-kick process (docker-discover), some backend services (whoami) and finally a consumers (ubuntu/curl).&lt;/p&gt;

&lt;p&gt;The registration and discovery components work as appliances alongside the the application containers so there is no embedded registration or discovery code in the backend or consumer containers.  They just listen on ports or connect to other local ports.&lt;/p&gt;

&lt;h2 id=&#34;service-registry-etcd:5152b7114a679e7779eb00e9843508ec&#34;&gt;Service Registry - Etcd&lt;/h2&gt;

&lt;p&gt;Before anything can be registered, we need some place to track registration entries (i.e. IP and ports of services).  We&amp;rsquo;re using etcd because it has a simple programming model for service registration and supports TTLs for keys and directories.&lt;/p&gt;

&lt;p&gt;Usually, you would run 3 or 5 etcd nodes but I&amp;rsquo;m just using one to keep things simple.&lt;/p&gt;

&lt;p&gt;There is no reason why we could not use &lt;a href=&#34;http://consul.io&#34;&gt;Consul&lt;/a&gt; or any other storage option that supports TTL expiration.&lt;/p&gt;

&lt;p&gt;To start etcd:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ docker run -d --name etcd -p 4001:4001 -p 7001:7001 coreos/etcd
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;service-registration-docker-register:5152b7114a679e7779eb00e9843508ec&#34;&gt;Service Registration - docker-register&lt;/h2&gt;

&lt;p&gt;Registering service containers is handled by the &lt;a href=&#34;https://registry.hub.docker.com/u/jwilder/docker-register/&#34;&gt;jwilder/docker-register&lt;/a&gt; container.  This container registers other containers running on the same host in etcd.
Containers we want registered must expose a port.  Containers running the same image on different hosts are grouped together in etcd and will form
a load-balanced cluster.  How containers are groups is somewhat arbitrary and I&amp;rsquo;ve chosen the container image name for this walkthrough.  In
a real deployment, you would likely want to group things by environment, service version, or other meta-data.&lt;/p&gt;

&lt;p&gt;(&lt;em&gt;The current implementation only supports one port per container and assumes it is TCP currently. There is no reason why multiple ports and types could not be supported as well as different grouping attributes.&lt;/em&gt;)&lt;/p&gt;

&lt;p&gt;docker-register uses &lt;a href=&#34;https://github.com/jwilder/docker-gen&#34;&gt;docker-gen&lt;/a&gt; along with a &lt;a href=&#34;https://github.com/jwilder/docker-register/blob/master/etcd.tmpl&#34;&gt;python script&lt;/a&gt; as a template.
It dynamically generates a script that, when run, will register each container&amp;rsquo;s IP and PORT under a &lt;code&gt;/backends&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;docker-gen takes care of monitoring docker events and calling the generated script on an interval to ensure TTLs are kept up to date.
If docker-register is stopped, the registrations expire.&lt;/p&gt;

&lt;p&gt;To start docker-register, we need to pass in the host&amp;rsquo;s external IP where other hosts can reach it&amp;rsquo;s containers as well as the address of your etcd host.  docker-gen requires access to the docker daemon in order to call it&amp;rsquo;s API so we bind mount the docker unix socket into the container as well.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ HOST_IP=$(hostname --all-ip-addresses | awk &#39;{print $1}&#39;)
$ ETCD_HOST=w.x.y.z:4001
$ docker run --name docker-register -d -e HOST_IP=$HOST_IP -e ETCD_HOST=$ETCD_HOST -v /var/run/docker.sock:/var/run/docker.sock -t jwilder/docker-register
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;service-discovery-docker-discover:5152b7114a679e7779eb00e9843508ec&#34;&gt;Service Discovery - docker-discover&lt;/h2&gt;

&lt;p&gt;Discovering services is handled by the &lt;a href=&#34;https://registry.hub.docker.com/u/jwilder/docker-discover/&#34;&gt;jwilder/docker-discover&lt;/a&gt; container.
docker-discover polls etcd periodically and generates an haproxy config with listeners for each type of registered service.&lt;/p&gt;

&lt;p&gt;For example, containers running &lt;a href=&#34;https://registry.hub.docker.com/u/jwilder/whoami/&#34;&gt;jwilder/whoami&lt;/a&gt; are registered under &lt;code&gt;/backends/whoami/&amp;lt;id&amp;gt;&lt;/code&gt; and are exposed on host port 8000.&lt;/p&gt;

&lt;p&gt;Other containers that need to call the &lt;a href=&#34;https://registry.hub.docker.com/u/jwilder/whoami/&#34;&gt;jwilder/whoami&lt;/a&gt; service, can send requests to docker bridge IP:8000 or host IP:8000.&lt;/p&gt;

&lt;p&gt;If any of the backend services goes down, haproxy health checks remove it from the pool and will retry the request on a healthy host.
This ensure that backend services can be started and stopped as needed as well as handling inconsistencies in the the registration information while ensuring minimal client impact.&lt;/p&gt;

&lt;p&gt;Finally, stats can be viewed by accessing port 1936 on the docker-discover container.&lt;/p&gt;

&lt;p&gt;To run docker-discover:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ ETCD_HOST=w.x.y.z:4001
$ docker run -d --net host --name docker-discover -e ETCD_HOST=$ETCD_HOST -p 127.0.0.1:1936:1936 -t jwilder/docker-discover
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We&amp;rsquo;re using &lt;code&gt;--net host&lt;/code&gt; so that the container uses the host&amp;rsquo;s network stack.  When this container binds port 8000, it&amp;rsquo;s actually binding
on the host&amp;rsquo;s network.  This simplifies the proxy setup.&lt;/p&gt;

&lt;h2 id=&#34;aws-demo:5152b7114a679e7779eb00e9843508ec&#34;&gt;AWS Demo&lt;/h2&gt;

&lt;p&gt;We&amp;rsquo;ll run the full thing on four AWS hosts: an etcd host, a client host and two backend hosts.  The &lt;a href=&#34;https://registry.hub.docker.com/u/jwilder/whoami/&#34;&gt;backend service&lt;/a&gt; is a simple
Golang HTTP server that returns it&amp;rsquo;s hostname (container ID).&lt;/p&gt;

&lt;h3 id=&#34;etcd-host:5152b7114a679e7779eb00e9843508ec&#34;&gt;Etcd Host&lt;/h3&gt;

&lt;p&gt;First we start our etcd registry:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ hostname --all-ip-addresses | awk &#39;{print $1}&#39;
10.170.71.226

$ docker run -d --name etcd -p 4001:4001 -p 7001:7001 coreos/etcd
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Our etcd address is &lt;code&gt;10.170.71.226&lt;/code&gt;.  We&amp;rsquo;ll use that on the other hosts.  If we were running this is a live environment, we could assign an EIP and
DNS address to it to make it easier to configure.&lt;/p&gt;

&lt;h3 id=&#34;backend-hosts:5152b7114a679e7779eb00e9843508ec&#34;&gt;Backend Hosts&lt;/h3&gt;

&lt;p&gt;Next, we start the the services and docker-register on each host.  The service is configured to listen
on port 8000 in the container and we let docker publish it on an random host port.&lt;/p&gt;

&lt;p&gt;On backend host 1:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ docker run -d -p 8000:8000 --name whoami -t jwilder/whoami
736ab83847bb12dddd8b09969433f3a02d64d5b0be48f7a5c59a594e3a6a3541
$ docker run --name docker-register -d -e HOST_IP=$(hostname --all-ip-addresses | awk &#39;{print $1}&#39;) -e ETCD_HOST=10.170.71.226:4001 -v /var/run/docker.sock:/var/run/docker.sock -t jwilder/docker-register
77a49f732797333ca0c7695c6b590a64a7d75c14b5ffa0f89f8e0e21ae47ae3e

$ docker ps
CONTAINER ID        IMAGE                            COMMAND                CREATED             STATUS              PORTS                     NAMES
736ab83847bb        jwilder/whoami:latest            /app/http              48 seconds ago      Up 47 seconds       0.0.0.0:49153-&amp;gt;8000/tcp   whoami
77a49f732797        jwilder/docker-register:latest   &amp;quot;/bin/sh -c &#39;docker-   28 minutes ago      Up 28 minutes                                 docker-register
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;On backend host 2:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ docker run -d -p 8000:8000 --name whoami -t jwilder/whoami
4eb0498e52076275ee0702d80c0d8297813e89d492cdecbd6df9b263a3df1c28
$ docker run --name docker-register -d -e HOST_IP=$(hostname --all-ip-addresses | awk &#39;{print $1}&#39;) -e ETCD_HOST=10.170.71.226:4001 -v /var/run/docker.sock:/var/run/docker.sock -t jwilder/docker-register
832e77c83591cb33bba53859153eb91d897f5a278a74d4ec1f66bc9b97deb221

$ docker ps
CONTAINER ID        IMAGE                            COMMAND                CREATED             STATUS              PORTS                     NAMES
4eb0498e5207        jwilder/whoami:latest            /app/http              59 seconds ago      Up 58 seconds       0.0.0.0:49154-&amp;gt;8000/tcp   whoami
832e77c83591        jwilder/docker-register:latest   &amp;quot;/bin/sh -c &#39;docker-   34 minutes ago      Up 34 minutes                                 docker-register
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;client-host:5152b7114a679e7779eb00e9843508ec&#34;&gt;Client Host&lt;/h3&gt;

&lt;p&gt;On the client host, we need to start docker-discover and a client container.  For the client container,
I&amp;rsquo;m using Ubuntu Trusty and will make some &lt;code&gt;curl&lt;/code&gt; requests.&lt;/p&gt;

&lt;p&gt;First start docker-discover:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ docker run -d --net host --name docker-discover -e ETCD_HOST=10.170.71.226:4001 -p 127.0.0.1:1936:1936 -t jwilder/docker-discover
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then, start a sample client container and pass in a HOST_IP.  We&amp;rsquo;re using the eth0 address but could also use docker0 IP.  We&amp;rsquo;re passing
this in as an environment variable since it is &lt;a href=&#34;http://12factor.net/config&#34;&gt;configuration that will vary between deploys&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ docker run -e HOST_IP=$(hostname --all-ip-addresses | awk &#39;{print $1}&#39;) -i -t ubuntu:14.04 /bin/bash
$ root@2af5f52de069:/# apt-get update &amp;amp;&amp;amp; apt-get -y install curl
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then, make some requests to the whoami service port 8000 to see them load-balanced.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 4eb0498e5207
$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 736ab83847bb
$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 4eb0498e5207
$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 736ab83847bb
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We can start some more instances on the backends:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ docker run -d -p :8000 --name whoami-2 -t jwilder/whoami
$ docker run -d -p :8000 --name whoami-3 -t jwilder/whoami

$ docker ps
CONTAINER ID        IMAGE                            COMMAND                CREATED             STATUS              PORTS                     NAMES
5d5c12c96192        jwilder/whoami:latest            /app/http              3 seconds ago       Up 1 seconds        0.0.0.0:49156-&amp;gt;8000/tcp   whoami-2
bb2a408b8ec5        jwilder/whoami:latest            /app/http              21 seconds ago      Up 20 seconds       0.0.0.0:49155-&amp;gt;8000/tcp   whoami-3
4eb0498e5207        jwilder/whoami:latest            /app/http              2 minutes ago       Up 2 minutes        0.0.0.0:49154-&amp;gt;8000/tcp   whoami
832e77c83591        jwilder/docker-register:latest   &amp;quot;/bin/sh -c &#39;docker-   36 minutes ago      Up 36 minutes                                 docker-register
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And make some requests again on the client hosts:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 736ab83847bb
$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 4eb0498e5207
$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m bb2a408b8ec5
$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 5d5c12c96192
$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 736ab83847bb
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Finally, we can shutdown some some containers and routes will be updated.  This kills everything on backend2.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ docker kill 5d5c12c96192 bb2a408b8ec5 4eb0498e5207

$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 736ab83847bb
$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 67c3cccbb8ba
$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 736ab83847bb
$ root@2af5f52de069:/# curl $HOST_IP:8000
I&#39;m 67c3cccbb8ba
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If we wanted to see how haproxy is balancing traffic or monitor for errors, we can access the client&amp;rsquo;s
host port 1936 in a web browser.&lt;/p&gt;

&lt;h2 id=&#34;wrapping-up:5152b7114a679e7779eb00e9843508ec&#34;&gt;Wrapping Up&lt;/h2&gt;

&lt;p&gt;While there are a lot of different ways to implement &lt;a href=&#34;http://jasonwilder.com/blog/2014/02/04/service-discovery-in-the-cloud/&#34;&gt;service discovery&lt;/a&gt;, SmartStack&amp;rsquo;s sidekick style
of registration and proxying keeps application code simple and easy to integrate in a distributed
environment and really fits well with Docker containers.&lt;/p&gt;

&lt;p&gt;Similarly, Docker&amp;rsquo;s event and container APIs facilitate service registration and discovery with registration services such as etcd.&lt;/p&gt;

&lt;p&gt;The code for &lt;a href=&#34;https://github.com/jwilder/docker-register&#34;&gt;docker-register&lt;/a&gt; and
&lt;a href=&#34;https://github.com/jwilder/docker-discover&#34;&gt;docker-discover&lt;/a&gt; is on github.  While both are functional
there is a lot that can be improved.  Please feel fee to submit or suggest improvements.&lt;/p&gt;
</description>
        </item>
        
        <item>
            <title>Open-Source Service Discovery</title>
            <link>http://jasonwilder.com/blog/2014/02/04/service-discovery-in-the-cloud/</link>
            <pubDate>Tue, 04 Feb 2014 00:00:00 UTC</pubDate>
            
            <guid>http://jasonwilder.com/blog/2014/02/04/service-discovery-in-the-cloud/</guid>
            <description>

&lt;p&gt;Service discovery is a key component of most distributed systems and service oriented architectures.
The problem seems simple at first: &lt;em&gt;How do clients determine the IP and port for a service that
exist on multiple hosts?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Usually, you start off with some static configuration which gets you pretty far.
Things get more complicated as you start deploying more services.  With a live
system, service locations can change quite frequently due to auto or manual scaling,
new deployments of services, as well as hosts failing or being replaced.&lt;/p&gt;

&lt;p&gt;Dynamic service registration and discovery becomes much more important in these scenarios in
order to avoid service interruption.&lt;/p&gt;

&lt;p&gt;This problem has been addressed in many different ways and is continuing to evolve.  We&amp;rsquo;re going to look at some open-source or openly-discussed solutions to this problem to understand how they work.  Specifically,
we&amp;rsquo;ll look at how each solution uses strong or weakly consistent storage, runtime dependencies, client
integration options and what the tradeoffs of those features might be.&lt;/p&gt;

&lt;p&gt;We&amp;rsquo;ll start with some strongly consistent projects such as &lt;a href=&#34;http://zookeeper.apache.org/&#34;&gt;Zookeeper&lt;/a&gt;,
&lt;a href=&#34;https://github.com/ha/doozer&#34;&gt;Doozer&lt;/a&gt; and &lt;a href=&#34;https://github.com/coreos/etcd&#34;&gt;Etcd&lt;/a&gt; which are typically
used as coordination services but are also used for service registries as well.&lt;/p&gt;

&lt;p&gt;We&amp;rsquo;ll then look at some interesting solutions specifically designed for service registration and discovery.
We&amp;rsquo;ll examine &lt;a href=&#34;http://nerds.airbnb.com/smartstack-service-discovery-cloud/&#34;&gt;Airbnb&amp;rsquo;s SmartStack&lt;/a&gt;,
&lt;a href=&#34;https://github.com/Netflix/eureka&#34;&gt;Netflix&amp;rsquo;s Eureka&lt;/a&gt;, &lt;a href=&#34;http://bitly.github.io/nsq/&#34;&gt;Bitly&amp;rsquo;s NSQ&lt;/a&gt;,
&lt;a href=&#34;http://serfdom.io&#34;&gt;Serf&lt;/a&gt;,
&lt;a href=&#34;http://labs.spotify.com/tag/dns/&#34;&gt;Spotify and DNS&lt;/a&gt; and finally &lt;a href=&#34;https://github.com/skynetservices/skydns&#34;&gt;SkyDNS&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&#34;the-problem:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;The Problem&lt;/h1&gt;

&lt;p&gt;There are two sides to the problem of locating services.  &lt;em&gt;Service Registration&lt;/em&gt; and &lt;em&gt;Service Discovery&lt;/em&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Service Registration&lt;/strong&gt; - The process of a service registering its location in a central registry.
It usually register its host and port and sometimes authentication credentials, protocols, versions numbers,
and/or environment details.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Service Discovery&lt;/strong&gt; - The process of a client application querying the central registry to learn
of the location of services.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Any service registration and discovery solution also has other development and operational aspects to consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Monitoring&lt;/strong&gt; - What happens when a registered service fails?  Sometimes it is unregistered immediately,
after a timeout, or by another process.  Services are usually required to implement a heartbeating mechanism
to ensure liveness and clients typically need to be able to handle failed services reliably.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Load Balancing&lt;/strong&gt; - If multiple services are registered, how do all the clients balance
the load across the services?  If there is a master, can it be deteremined by a client correctly?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Integration Style&lt;/strong&gt; - Does the registry only provide a few language bindings, for example, only Java?
Does integrating require embedding registration and discovery code into your application or is a
&lt;em&gt;sidekick&lt;/em&gt; process an option?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Runtime Dependencies&lt;/strong&gt; - Does it require the JVM, Ruby or something that is not compatible
with your environment?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Availability Concerns&lt;/strong&gt; - Can you lose a node and still function?  Can it be upgraded without
incurring an outage?  The registry will grow to be a central part of your architecture and could
be a single point of failure.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&#34;general-purpose-registries:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;General Purpose Registries&lt;/h1&gt;

&lt;p&gt;These first three registries use strongly consistent protocols and are actually general purpose, consistent
datastores.  Although we&amp;rsquo;re looking at them as service registries, they are typically used for coordination
services to aid in leader election or centralized locking with a distributed set of clients.&lt;/p&gt;

&lt;h2 id=&#34;zookeeper:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;Zookeeper&lt;/h2&gt;

&lt;p&gt;&lt;a href=&#34;http://zookeeper.apache.org/&#34;&gt;Zookeeper&lt;/a&gt; is a centralized service for maintaining configuration
information, naming, providing distributed synchronization, and providing group services.  It&amp;rsquo;s written in Java, is strongly consistent (CP) and uses the &lt;a href=&#34;http://www.stanford.edu/class/cs347/reading/zab.pdf&#34;&gt;Zab&lt;/a&gt; protocol to coordinate changes across the ensemble (cluster).&lt;/p&gt;

&lt;p&gt;Zookeeper is typically run with three, five or seven members in the ensemble.  Clients use language
specific &lt;a href=&#34;https://cwiki.apache.org/confluence/display/ZOOKEEPER/ZKClientBindings&#34;&gt;bindings&lt;/a&gt; in order to access the ensemble.
Access is typically embedded into the client applications and services.&lt;/p&gt;

&lt;p&gt;Service registration is implemented with &lt;a href=&#34;http://zookeeper.apache.org/doc/r3.2.1/zookeeperProgrammers.html#Ephemeral+Nodes&#34;&gt;ephemeral nodes&lt;/a&gt;
under a namespace.  Ephemeral nodes only exist while the client is connected so typically a backend service registers itself, after startup, with its
location information.  If it fails or disconnects, the node disappears from the tree.&lt;/p&gt;

&lt;p&gt;Service discovery is implemented by listing and watching the namespace for the service.  Clients
receive all the currently registered services as well as notifications when a service becomes unavailable
or new ones register.  Clients also need to handle any load balancing or failover themselves.&lt;/p&gt;

&lt;p&gt;The Zookeeper API can be difficult to use properly and language bindings might have subtle differences
that could cause problems.
If you&amp;rsquo;re using a JVM based language, the &lt;a href=&#34;http://curator.apache.org/curator-x-discovery/index.html&#34;&gt;Curator Service Discovery Extension&lt;/a&gt; might be of some use.&lt;/p&gt;

&lt;p&gt;Since Zookeeper is a CP system, when a &lt;a href=&#34;http://wiki.apache.org/hadoop/ZooKeeper/FailureScenarios&#34;&gt;partition&lt;/a&gt; occurs,
some of your system will not be able to register or find existing registrations even if they could function properly during the
partition.  Specifically, on any non-quorum side, reads and writes will return an error.&lt;/p&gt;

&lt;h2 id=&#34;doozer:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;Doozer&lt;/h2&gt;

&lt;p&gt;&lt;a href=&#34;https://github.com/ha/doozerd&#34;&gt;Doozer&lt;/a&gt; is a consistent, distributed data store.  It&amp;rsquo;s written in Go,
is strongly consistent and uses &lt;a href=&#34;http://research.microsoft.com/en-us/um/people/lamport/pubs/lamport-paxos.pdf&#34;&gt;Paxos&lt;/a&gt;
to maintain consensus.  The project has been around for a number of years but has stagnated for
a while and now has close to 160 forks.  Unfortunately, this makes it
difficult to know what the actual state of the project is and whether is is suitable for production
use.&lt;/p&gt;

&lt;p&gt;Doozer is typically run with three, five or seven nodes in the cluster.  Clients use language
specific bindings to access the cluster and, similar to Zookeeper, integration is embedded
into the client and services.&lt;/p&gt;

&lt;p&gt;Service registration is not as straightforward as with Zookeeper because Doozer does not have any
concept of ephemeral nodes.  A service can register itself under a path but if the service becomes
unavailable, it won&amp;rsquo;t be removed automatically.&lt;/p&gt;

&lt;p&gt;There are a number of ways to address this issue. One option might be to add a timestamp and
heartbeating mechanism to the registration process and
handle expired entries during the discovery process or with another cleanup processes.&lt;/p&gt;

&lt;p&gt;Service discovery is similar to Zookeeper in that you can list all the entries under a path and
then wait for any changes to that path.  If you use a timestamp and heartbeat during registration, you
would ignore or delete any expired entries during discovery.&lt;/p&gt;

&lt;p&gt;Like Zookeeper, Doozer is also a CP system and has the same consequences when a partition occurs.&lt;/p&gt;

&lt;h2 id=&#34;etcd:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;Etcd&lt;/h2&gt;

&lt;p&gt;&lt;a href=&#34;https://github.com/coreos/etcd&#34;&gt;Etcd&lt;/a&gt; is a highly-available, key-value store for shared configuration and service discovery.  Etcd
was inspired by Zookeeper and Doozer.  It&amp;rsquo;s written in Go, uses &lt;a href=&#34;https://ramcloud.stanford.edu/wiki/download/attachments/11370504/raft.pdf&#34;&gt;Raft&lt;/a&gt;
for consensus and has a HTTP+JSON based API.&lt;/p&gt;

&lt;p&gt;Etcd, similar to Doozer and Zookeeper, is usually run with three, five or seven nodes in the cluster.
Clients use a language specific binding or implement one using an HTTP client.&lt;/p&gt;

&lt;p&gt;Service registration relies on &lt;a href=&#34;https://github.com/coreos/etcd#using-key-ttl&#34;&gt;using a key TTL&lt;/a&gt; along
with heartbeating from the service to ensure the key remains available.  If a services fails to
update the key&amp;rsquo;s TTL, Etcd will expire it.  If a service becomes unavailable,
clients will need to handle the connection failure and try another service instance.&lt;/p&gt;

&lt;p&gt;Service discovery involves listing the keys under a directory and then waiting for changes on the
directory.  Since the API is HTTP based, the client application keeps a long-polling connection
open with the Etcd cluster.&lt;/p&gt;

&lt;p&gt;Since Etcd uses &lt;a href=&#34;https://ramcloud.stanford.edu/wiki/download/attachments/11370504/raft.pdf&#34;&gt;Raft&lt;/a&gt;, it
should be a strongly-consistent system.  Raft requires a leader to be elected and all client requests are handled by
the leader. However, Etcd also seems to support reads from non-leaders using this &lt;a href=&#34;https://github.com/coreos/etcd/blob/master/server/v2/get_handler.go#L25&#34;&gt;undocumented consistent parameter&lt;/a&gt; which would improve
availabilty in the read case.  Writes would still need to be handled by the leader during a partition and could
fail.&lt;/p&gt;

&lt;h1 id=&#34;single-purpose-registries:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;Single Purpose Registries&lt;/h1&gt;

&lt;p&gt;These next few registration services and approaches are specifically tailored to service registration
and discovery.  Most have come about from actual production use cases while others are interesting
and different approaches to the problem.  Whereas Zookeeper, Doozer and Etcd could also be used for
distributed coordination, these solutions don&amp;rsquo;t have that capability.&lt;/p&gt;

&lt;h2 id=&#34;airbnb-s-smartstack:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;Airbnb&amp;rsquo;s SmartStack&lt;/h2&gt;

&lt;p&gt;&lt;a href=&#34;http://nerds.airbnb.com/smartstack-service-discovery-cloud/&#34;&gt;Airbnb&amp;rsquo;s SmartStack&lt;/a&gt; is a combination
of two custom tools, &lt;a href=&#34;https://github.com/airbnb/nerve&#34;&gt;Nerve&lt;/a&gt; and &lt;a href=&#34;https://github.com/airbnb/synapse&#34;&gt;Synapse&lt;/a&gt;
that leverage &lt;a href=&#34;http://haproxy.1wt.eu/&#34;&gt;haproxy&lt;/a&gt; and &lt;a href=&#34;http://zookeeper.apache.org/&#34;&gt;Zookeeper&lt;/a&gt; to handle
service registration and discovery.  Both Nerve and Synapse are written in Ruby.&lt;/p&gt;

&lt;p&gt;Nerve is a &lt;em&gt;sidekick&lt;/em&gt; style process that runs as a separate process alongside the application service.
Nerve is reponsible for registering services in Zookeeper.  Applications expose a &lt;code&gt;/health&lt;/code&gt; endpoint,
for HTTP services, that Nerve continuously monitors.  Provided the service is available, it will be
registered in Zookeper.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;sidekick&lt;/em&gt; model eliminates the need for a service to interact with Zookeeper. It simply needs
a monitoring endpoint in order to be registered.  This makes it much easier to support services in different
languages where robust Zookeeper binding might not exist.  This also provides many of benefits of the
&lt;a href=&#34;http://en.wikipedia.org/wiki/Hollywood_principle&#34;&gt;Hollywood principle&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Synapse is also a &lt;em&gt;sidekick&lt;/em&gt; style process that runs as a separate process alongside the service.
Synapse is responsible for service discovery.  It does this by querying Zookeeper for currently
registered services and reconfigures a locally running haproxy instance.  Any clients on the host
that need to access another service always accesses the local haproxy instance which will route the
request to an available service.&lt;/p&gt;

&lt;p&gt;Synapse&amp;rsquo;s design simplifies service implementations in that they do not need to implement any client
side load balancing or failover and they do not need to depend on Zookeepr or its language bindings.&lt;/p&gt;

&lt;p&gt;Since SmartStack relies on Zookeeper, some registrations and discovery may fail during a partition.
They point out that Zookeepr is their &amp;ldquo;Achilles heel&amp;rdquo; in this setup.
Provided a service has been able to discover the other services, at least once, before a partition, it should still
have a snapshot of the services after the partition and may be able to continue operating during the
partition.  This aspect improves the availability and reliability of the overall system.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update: If you&amp;rsquo;re intested in a SmartStack style solution for docker containers, check out &lt;a href=&#34;http://jasonwilder.com/blog/2014/07/15/docker-service-discovery&#34;&gt;docker service discovery&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&#34;netflix-s-eureka:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;Netflix&amp;rsquo;s Eureka&lt;/h2&gt;

&lt;p&gt;&lt;a href=&#34;https://github.com/Netflix/eureka&#34;&gt;Eureka&lt;/a&gt; is Netflix&amp;rsquo;s middle-tier, load balancing and discovery
service.  There is a server component as well as a smart-client that is used within application
services.  The server and client are written in Java which means the ideal use case would be for
the services to also be imlemented in Java or another JVM compatible language.&lt;/p&gt;

&lt;p&gt;The Eureka server is the registry for services.  They recommend running one Eureka server in each
availability zone in AWS to form a cluster.  The servers replicate their state to each
other through an asynchronous model which means each instance may have a slightly, different picture
of all the services at any given time.&lt;/p&gt;

&lt;p&gt;Service registration is handled by the client component.  Services embed the client in their application
code. At runtime, the client registers the service and periodically sends heartbeats to renew its leases.&lt;/p&gt;

&lt;p&gt;Service discovery is handled by the smart-client as well.  It retrieves the current registrations from the
server and caches them locally.  The client periodically refreshes its state and also handles load
balancing and failovers.&lt;/p&gt;

&lt;p&gt;Eureka was designed to be very resilient during failures. It favors availabilty over
strong consistency and can operate under a number of different failure modes.  If there is a partition within the cluster,
Eureka transitions to a self-preservation state.  It will allow services to be discovered and registered
during a partition and when it heals, the members will merge their state again.&lt;/p&gt;

&lt;h2 id=&#34;bitly-s-nsq-lookupd:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;Bitly&amp;rsquo;s NSQ lookupd&lt;/h2&gt;

&lt;p&gt;&lt;a href=&#34;https://github.com/bitly/nsq&#34;&gt;NSQ&lt;/a&gt; is a realtime, distributed messaging platform. It&amp;rsquo;s written in Go
and provides an HTTP based API.  While it&amp;rsquo;s not a general purpose service registration and discovery tool,
they have implemented a novel model of service discovery in their
&lt;a href=&#34;http://bitly.github.io/nsq/components/nsqlookupd.html&#34;&gt;nsqlookupd&lt;/a&gt; agent
in order for clients to find &lt;a href=&#34;http://bitly.github.io/nsq/components/nsqd.html&#34;&gt;nsqd&lt;/a&gt; instances at
runtime.&lt;/p&gt;

&lt;p&gt;In an NSQ deployment, the nsqd instances are essentially the service.  These are the message stores.
nsqlookupd is the service registry.  Clients connect directly to nsqd instances but since these may
change at runtime, clients can discover the available instances by querying nsqlookupd instances.&lt;/p&gt;

&lt;p&gt;For service registration, each nsqd instance periodically sends a heartbeat of its state to each nsqlookupd
instance.  Their state includes their address and any queues or topics they have.&lt;/p&gt;

&lt;p&gt;For discovery, clients query each nsqlookupd instance and merge the results.&lt;/p&gt;

&lt;p&gt;What is interesting about this model is that the nsqlookupd instances &lt;em&gt;do not know about each other&lt;/em&gt;.
It&amp;rsquo;s the responsibility of the clients to merge the state returned from each stand-alone nsqlookupd instance to
determine the overal state.  Because each nsqd instance heartbeats its state, each nsqlookupd eventually
has the same information provided each nsqd instance can contact all available nsqlookupd instances.&lt;/p&gt;

&lt;p&gt;All the previously discussed registry components all form a cluster and use strong or weakly consistent
consensus protocols to maintain their state. The NSQ design is inherently weakly consistent but
very tolerant to partitions.&lt;/p&gt;

&lt;h2 id=&#34;serf:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;Serf&lt;/h2&gt;

&lt;p&gt;&lt;a href=&#34;http://serfdom.io&#34;&gt;Serf&lt;/a&gt; is a decentralized solution for service discovery and orchestration.  It is also
written in Go and is unique in that uses a gossip based protocol, &lt;a href=&#34;http://www.cs.cornell.edu/~asdas/research/dsn02-swim.pdf&#34;&gt;SWIM&lt;/a&gt; for membership, failure detection and custom event propogation.  SWIM was designed to address the unscalability of traditional heart-beating protocols.&lt;/p&gt;

&lt;p&gt;Serf consists of a single binary that is installed on all hosts.  It can be run as an agent, where it
joins or creates a cluster, or as a client where it can discover the members in the cluster.&lt;/p&gt;

&lt;p&gt;For service registration, a serf agent is run that joins an existing cluster.  The agent is started
with custom tags that can identify the hosts role, env, ip, ports, etc.  Once joined to the cluster, other
members will be able to see this host and it&amp;rsquo;s metadata.&lt;/p&gt;

&lt;p&gt;For discovery, serf is run with the &lt;code&gt;members&lt;/code&gt; command which returns the current members of the
cluster. Using
the members output, you can discover all the hosts for a service based on the tags their agent is
running.&lt;/p&gt;

&lt;p&gt;Serf is a relatively new project and is evolving quickly. It is the only project in this post that
does not have a central registry architectural style which makes it unique.  Since it uses a asynchronous, gossip based protocol, it is inherently weakly-consistent but more fault tolerant and available.&lt;/p&gt;

&lt;h2 id=&#34;spotify-and-dns:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;Spotify and DNS&lt;/h2&gt;

&lt;p&gt;Spotify described their use of DNS for service discovery in their post
&lt;a href=&#34;http://labs.spotify.com/tag/dns/&#34;&gt;In praise of &amp;ldquo;boring&amp;rdquo; technology&lt;/a&gt;.  Instead of using a newer, less
mature technology they opted to build on top of DNS.  Spotify views DNS as a
&amp;ldquo;distributed, replicated database tailored for read-heavy loads.&amp;rdquo;&lt;/p&gt;

&lt;p&gt;Spotify uses the relatively unknown &lt;a href=&#34;http://en.wikipedia.org/wiki/SRV_record&#34;&gt;SRV record&lt;/a&gt; which is intended
for service discovery.  SRV records can be thought of as a more generalized MX record.  They allow you
to define a service name, protocol, TTL, priority, weight, port and target host.  Basically, everything
a client would need to find all available services and load balance against them if necessary.&lt;/p&gt;

&lt;p&gt;Service registration is complicated and fairly static in their setup since they manage all zone files
under source control.  Discovery uses a number of different DNS client librarires and custom tools.  They
also run DNS caches on their services to minimize load on the root DNS server.&lt;/p&gt;

&lt;p&gt;They mention at the end of their post that this model has worked well for them but they are starting
to outgrow it and are investigating Zookeeper to support both static and dynamic registration.&lt;/p&gt;

&lt;h2 id=&#34;skydns:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;SkyDNS&lt;/h2&gt;

&lt;p&gt;&lt;a href=&#34;https://github.com/skynetservices/skydns&#34;&gt;SkyDNS&lt;/a&gt; is a relatively new project that is written in Go,
uses RAFT for consensus and also provides a client API over HTTP and DNS.  It has some
similarities to Etcd and Spotify&amp;rsquo;s DNS model and actually uses the same RAFT implementation as Etcd,
&lt;a href=&#34;https://github.com/goraft/raft&#34;&gt;go-raft&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;SkyDNS servers are clustered together, and using the RAFT protocol, elect a leader.  The SkyDNS servers
expose different endpoints for registration and discovery.&lt;/p&gt;

&lt;p&gt;For service registration, services use an HTTP based API to create an entry with a TTL.  Services must
heartbeat their state periodically.  SkyDNS also uses SRV records but extends them to also support
service version, environment, and region.&lt;/p&gt;

&lt;p&gt;For discovery, clients use DNS and retrieve the SRV records for the services they need to contact.
Clients need to implement any load balancing or failover and will likely cache and refresh service
location data periodically.&lt;/p&gt;

&lt;p&gt;Unlike Spotify&amp;rsquo;s use of DNS, SkyDNS does support dynamic service registration and is able to do this
without depending on another external service such as Zookeeper or Etcd.&lt;/p&gt;

&lt;p&gt;If you are using &lt;a href=&#34;http://docker.io&#34;&gt;docker&lt;/a&gt;, &lt;a href=&#34;https://github.com/crosbymichael/skydock&#34;&gt;skydock&lt;/a&gt; might be worth checking out to integrate your containers with SkyDNS automatically.&lt;/p&gt;

&lt;p&gt;Overall, this is an interesting mix of old (DNS) and new (Go, RAFT) technology and will be interesting
to see how the project evolves.&lt;/p&gt;

&lt;h1 id=&#34;summary:eabab4b56ce615c8817b5fecb3a27fdf&#34;&gt;Summary&lt;/h1&gt;

&lt;p&gt;We&amp;rsquo;ve looked at a number of general purpose, strongly consistent registries (Zookeeper, Doozer, Etcd)
as well as many custom built, eventually consistent ones (SmartStack, Eureka, NSQ, Serf, Spotify&amp;rsquo;s DNS, SkyDNS).&lt;/p&gt;

&lt;p&gt;Many use embedded client libraries (Eureka, NSQ, etc..) and some use separate sidekick processes
(SmartStack, Serf).&lt;/p&gt;

&lt;p&gt;Interestingly, of the dedicated solutions, all of them have adopted a design that
prefers availability over consistency.&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;AP or CP&lt;/th&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Dependencies&lt;/th&gt;
&lt;th&gt;Integration&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Zookeeper&lt;/td&gt;
&lt;td&gt;General&lt;/td&gt;
&lt;td&gt;CP&lt;/td&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;JVM&lt;/td&gt;
&lt;td&gt;Client Binding&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Doozer&lt;/td&gt;
&lt;td&gt;General&lt;/td&gt;
&lt;td&gt;CP&lt;/td&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Client Binding&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Etcd&lt;/td&gt;
&lt;td&gt;General&lt;/td&gt;
&lt;td&gt;Mixed (1)&lt;/td&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Client Binding/HTTP&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;SmartStack&lt;/td&gt;
&lt;td&gt;Dedicated&lt;/td&gt;
&lt;td&gt;AP&lt;/td&gt;
&lt;td&gt;Ruby&lt;/td&gt;
&lt;td&gt;haproxy/Zookeeper&lt;/td&gt;
&lt;td&gt;Sidekick (nerve/synapse)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Eureka&lt;/td&gt;
&lt;td&gt;Dedicated&lt;/td&gt;
&lt;td&gt;AP&lt;/td&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;JVM&lt;/td&gt;
&lt;td&gt;Java Client&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;NSQ (lookupd)&lt;/td&gt;
&lt;td&gt;Dedicated&lt;/td&gt;
&lt;td&gt;AP&lt;/td&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Client Binding&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Serf&lt;/td&gt;
&lt;td&gt;Dedicated&lt;/td&gt;
&lt;td&gt;AP&lt;/td&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Local CLI&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Spotify (DNS)&lt;/td&gt;
&lt;td&gt;Dedicated&lt;/td&gt;
&lt;td&gt;AP&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;td&gt;Bind&lt;/td&gt;
&lt;td&gt;DNS Library&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;SkyDNS&lt;/td&gt;
&lt;td&gt;Dedicated&lt;/td&gt;
&lt;td&gt;Mixed (2)&lt;/td&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;HTTP/DNS Library&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;(1) If using the &lt;code&gt;consistent&lt;/code&gt; parameter, inconsistent reads are possible&lt;/p&gt;

&lt;p&gt;(2) If using a caching DNS client in front of SkyDNS, reads could be inconsistent&lt;/p&gt;
</description>
        </item>
        
        <item>
            <title>Fluentd vs Logstash</title>
            <link>http://jasonwilder.com/blog/2013/11/19/fluentd-vs-logstash/</link>
            <pubDate>Tue, 19 Nov 2013 00:00:00 UTC</pubDate>
            
            <guid>http://jasonwilder.com/blog/2013/11/19/fluentd-vs-logstash/</guid>
            <description>

&lt;p&gt;&lt;a href=&#34;http://fluentd.org&#34;&gt;Fluentd&lt;/a&gt; and &lt;a href=&#34;http://logstash.net&#34;&gt;Logstash&lt;/a&gt; are two open-source projects that
focus on the problem of centralized logging.  Both projects address the &lt;a href=&#34;http://jasonwilder.com/blog/2013/07/16/centralized-logging-architecture/&#34;&gt;collection and transport&lt;/a&gt;
aspect of centralized logging using different approaches.&lt;/p&gt;

&lt;p&gt;This post will walk through a sample deployment to see how each differs from the other.  We&amp;rsquo;ll look
at the dependencies, features, deployment architecture and potential issues.  The point is not to figure out
which one is the best, but rather to see which one would be a better fit for your environment.&lt;/p&gt;

&lt;p&gt;The example setup we&amp;rsquo;ll walk through is collecting web server logs on multiple hosts and archiving
them to S3:&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://jasonwilder.com/images/centralized-logging-s3.png&#34; alt=&#34;Centralized Logs With S3&#34; /&gt;&lt;/p&gt;

&lt;p&gt;This type of architecture would be suitable for archival or processing with
&lt;a href=&#34;http://hive.apache.org/&#34;&gt;Hive&lt;/a&gt; or &lt;a href=&#34;http://pig.apache.org/&#34;&gt;Pig&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Another common architecture is storing logs in &lt;a href=&#34;http://www.elasticsearch.org/&#34;&gt;ElasticSearch&lt;/a&gt; to
make them searchable with &lt;a href=&#34;http://www.elasticsearch.org/overview/kibana/&#34;&gt;Kibana&lt;/a&gt;
or &lt;a href=&#34;http://graylog2.org/&#34;&gt;Graylog2&lt;/a&gt;. Setting that up is somewhat independent of using Logstash
or Fluentd so I&amp;rsquo;ve left that out to keep things simple.&lt;/p&gt;

&lt;h2 id=&#34;installation-requirements:d94954b9a471ac6eb86d0c66c558309a&#34;&gt;Installation Requirements&lt;/h2&gt;

&lt;h3 id=&#34;logstash:d94954b9a471ac6eb86d0c66c558309a&#34;&gt;Logstash&lt;/h3&gt;

&lt;p&gt;Logstash is a &lt;a href=&#34;http://jruby.org/&#34;&gt;JRuby&lt;/a&gt; based application which requires the JVM to run.  Since it runs on the JVM, it
can run anywhere the JVM does, which is usually means Linux, Mac OSX, and Windows.  The package is shipped
as single executable jar file which makes it very easy to install.&lt;/p&gt;

&lt;p&gt;One of the downsides of depending on the JVM is that it&amp;rsquo;s memory footprint can be higher than you
would want for transporting logs.  Fortunately, &lt;a href=&#34;https://github.com/elasticsearch/logstash-forwarder&#34;&gt;Lumberjack&lt;/a&gt;
can be run on individual hosts to collect and ship logs and Logstash can be run on the
centralized log hosts.&lt;/p&gt;

&lt;p&gt;Lumberjack is a Go based project with a much smaller memory
and CPU footprint. Deployment is still straightforward as Logstash and is basically installing a single
binary.  The project provides &lt;code&gt;deb&lt;/code&gt; and &lt;code&gt;rpm&lt;/code&gt; packages to make it easier to deploy.
An SSL certificates is required to setup authentication between Lumberjack and Logstash which is
a little more complicated, but a nice benefit that encrypted transport is the default.&lt;/p&gt;

&lt;h3 id=&#34;fluentd:d94954b9a471ac6eb86d0c66c558309a&#34;&gt;Fluentd&lt;/h3&gt;

&lt;p&gt;Fluentd is a &lt;a href=&#34;http://en.wikipedia.org/wiki/Ruby_MRI&#34;&gt;CRuby&lt;/a&gt; application which requires Ruby 1.9.2 or later.  There is an open-source
version, fluentd, as well as a commercial version, td-agent.  Fluentd runs on Linux and Mac OSX,
but &lt;a href=&#34;http://docs.fluentd.org/articles/faq#does-fluentd-run-on-windows&#34;&gt;does not run on Windows&lt;/a&gt; currently.&lt;/p&gt;

&lt;p&gt;For larger installs, they recommend using &lt;a href=&#34;http://www.canonware.com/jemalloc/&#34;&gt;jemalloc&lt;/a&gt; to
avoid memory fragmentation.  This is included in the &lt;code&gt;deb&lt;/code&gt; and &lt;code&gt;rpm&lt;/code&gt; packages but needs to be installed
manually if using the open-source version.&lt;/p&gt;

&lt;p&gt;If you use the open-source version, you&amp;rsquo;ll need to install Fluentd from source or via &lt;code&gt;gem install&lt;/code&gt;.
Since Fluentd is primarily developed by a commercial company, their &lt;code&gt;deb&lt;/code&gt; and &lt;code&gt;rpm&lt;/code&gt; packages are
configured to send data to their hosted centralized logging platform.&lt;/p&gt;

&lt;p&gt;Apart from Ruby, they also recommend running &lt;code&gt;ntpd&lt;/code&gt; which you should be running anyways.&lt;/p&gt;

&lt;h2 id=&#34;feature-comparison:d94954b9a471ac6eb86d0c66c558309a&#34;&gt;Feature Comparison&lt;/h2&gt;

&lt;p&gt;Logstash supports a number of inputs, codecs, filters and outputs.  Inputs are sources of data.
Codecs essentially convert an incoming format into an internal Logstash representation as well
as convert back out to an output format.  These are usually used if the incoming message is not
just a single line of text.  Filters are processing actions on events and
allow you to modify events or drop events as they are processed.  Finally, outputs are destinations
where events can be routed.&lt;/p&gt;

&lt;p&gt;Fluentd is similar in that it has inputs and outputs and a matching mechanism to route
log data between destinations.  Internally,
log messages are converted to JSON which provides structure to an unstructered log message.
Messages can be tagged and then routed to different outputs.&lt;/p&gt;

&lt;p&gt;Both projects have very similar capabilities and highlighting the difference between them from a
feature standpoint is difficult.  They both have plugin models that allow you to extend their functionality
if needed.  They also have rich repository of plugins already available.&lt;/p&gt;

&lt;p&gt;Probably the most significant difference between Fluentd and Logstash is their design focus.
&lt;em&gt;Logstash emphasizes flexibility and interoperability&lt;/em&gt; whereas
&lt;em&gt;Fluentd prioritizes simplicity and robustness&lt;/em&gt;.  This does not mean that
Logstash is not robust or Fluentd is not flexible, rather each has prioritized
features differently.&lt;/p&gt;

&lt;p&gt;Fluentd has fewer inputs than Logstash, out of the box, but many of the inputs
and outputs have built-in support for buffering, load-balancing, timeouts and retries.  These
types of features are necessary for ensuring data is reliably delivered.&lt;/p&gt;

&lt;p&gt;For example, the
&lt;a href=&#34;http://docs.fluentd.org/articles/out_forward&#34;&gt;out_forward&lt;/a&gt; plugin used to transfer logs from one
fluentd instance to another has many robustness options that can be configured to ensure messages
are delivered reliably.&lt;/p&gt;

&lt;h2 id=&#34;architecture-comparison:d94954b9a471ac6eb86d0c66c558309a&#34;&gt;Architecture comparison&lt;/h2&gt;

&lt;p&gt;From a deployment architecture standpoint, both frameworks are very similar.  With Logstash, each
web server would be configured to run Lumberjack and tail the web server logs.  Lumberjack would forward the logs
to a server running Logstash with a Lumberjack input.  The Logstash server would also have an
output configured using the &lt;a href=&#34;http://logstash.net/docs/1.2.2/outputs/s3&#34;&gt;S3 output&lt;/a&gt;.  Since Lumberjack
requires SSL certs, the log transfers would be encrypted from the web server to the log server.&lt;/p&gt;

&lt;p&gt;With fluentd, each web server would run fluentd and tail the web server logs and forward them to
another server running fluentd as well.  This server would be configured to receive logs and write
them to S3 using the &lt;a href=&#34;https://github.com/fluent/fluent-plugin-s3&#34;&gt;S3 plugin&lt;/a&gt;.  Fluentd does not
support encryption so logs would be transferred unencrypted.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update: &lt;a href=&#34;https://twitter.com/repeatedly/status/402869393148760064&#34;&gt;@repeatedly&lt;/a&gt; pointed me to the
&lt;a href=&#34;https://github.com/tagomoris/fluent-plugin-secure-forward&#34;&gt;fluent-plugin-secure-forward&lt;/a&gt;
that some companies are using for encrypted transport.&lt;/em&gt;&lt;/p&gt;

&lt;h3 id=&#34;improving-availability:d94954b9a471ac6eb86d0c66c558309a&#34;&gt;Improving Availability&lt;/h3&gt;

&lt;p&gt;One central log server is a single point of failure.  What happens if we wanted to have more than
one central log server?&lt;/p&gt;

&lt;p&gt;Lumberjack can be configured to use &lt;a href=&#34;https://github.com/elasticsearch/logstash-forwarder#configuring&#34;&gt;multiple servers&lt;/a&gt;
but will only send logs to one until that one fails.  If that happens, previously collected log data
won&amp;rsquo;t be accessible until that host is resurrected.  Essentially, it supports a master with hot-standby
servers.&lt;/p&gt;

&lt;p&gt;Fluentd on the other hand can forward two copies of the logs to each server if needed, load-balance
between multiple hosts or have a master with a hot-standy in case of failure.  There are lot of
options for not only improving availabilty but also scalability if your log volume increases
substantially. Keep in mind, that if you forward multiple copies, this could create duplicate logs
in S3 which might need to be handled when you analyze them.&lt;/p&gt;

&lt;h2 id=&#34;potential-issues:d94954b9a471ac6eb86d0c66c558309a&#34;&gt;Potential Issues&lt;/h2&gt;

&lt;p&gt;The &lt;a href=&#34;http://logstash.net/docs/1.2.2/tutorials/getting-started-centralized&#34;&gt;Logstash docs&lt;/a&gt; suggests
using &lt;a href=&#34;http://redis.io&#34;&gt;Redis&lt;/a&gt; as the receiving output if you run Logstash (not Lumberjack) on each
host.  This setup is based on Redis Lists and/or Pub/Sub which can lose messages if
the receiver dies after removing the message from Redis and before it has had a chance to forward it
along.  Additionally, Redis would need to be configured with &lt;a href=&#34;http://redis.io/topics/persistence&#34;&gt;AOF&lt;/a&gt;
to minimize the chance of lost messages if Redis were to fail.&lt;/p&gt;

&lt;p&gt;There is a document describing &lt;a href=&#34;http://logstash.net/docs/1.2.2/life-of-an-event&#34;&gt;the life of an event&lt;/a&gt;
that discusses some of the failure modes and how Logstash addresses them.  One important point is
that outputs are responsible for retrying events in the case of errors.  There are also internal,
ephemeral queues within Logstash that can hold up to 20 events.  Depending on the failure, there is
a window for messages to be lost.&lt;/p&gt;

&lt;p&gt;If you absolutely cannot risk losing messages, make sure you investigate all the failure modes and
whether the plugins you are using are implemented correctly to handle them.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update: &lt;a href=&#34;https://logstash.jira.com/browse/LOGSTASH-1631&#34;&gt;LOGSTASH-1631&lt;/a&gt; is a bug that
demonstrates one way messages can be lost. It appears the internal messaging is going to be
replaced with a more reliable implementation in the future.&lt;/em&gt;&lt;/p&gt;

&lt;h2 id=&#34;conclusion:d94954b9a471ac6eb86d0c66c558309a&#34;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Both Logstash and Fluentd are viable centralized logging frameworks that can transfer logs from
multiple hosts to a central location.  Logstash is incredibly flexible with many input and output
plugins whereas fluentd provides fewer input and output sources but provides multiple options
for reliably and robust transport.&lt;/p&gt;
</description>
        </item>
        
        <item>
            <title>Centralized Logging Architecture</title>
            <link>http://jasonwilder.com/blog/2013/07/16/centralized-logging-architecture/</link>
            <pubDate>Tue, 16 Jul 2013 00:00:00 UTC</pubDate>
            
            <guid>http://jasonwilder.com/blog/2013/07/16/centralized-logging-architecture/</guid>
            <description>

&lt;p&gt;In &lt;a href=&#34;http://jasonwilder.com/blog/2012/01/03/centralized-logging/&#34;&gt;Centralized Logging&lt;/a&gt;, I covered a few tools that help
with the problem of centralized logging.  Many of these tools address only a portion of the problem
which means you need to use several of them together to build a robust solution.&lt;/p&gt;

&lt;p&gt;The main aspects you will need to address are: &lt;em&gt;collection, transport, storage&lt;/em&gt;, and &lt;em&gt;analysis&lt;/em&gt;.  In some special cases, you may
also want to have an &lt;em&gt;alerting&lt;/em&gt; capability as well.&lt;/p&gt;

&lt;h3 id=&#34;collection:a45c0fcecce9d83887cd906ffc8b7137&#34;&gt;Collection&lt;/h3&gt;

&lt;p&gt;Applications create logs in different ways, some log through syslog, others log directly to files.  If you
consider a typical web application running on a linux hosts, there will be a dozen or more log files
in /var/log as well as a few application specific logs in home directories or other locations.&lt;/p&gt;

&lt;p&gt;If you are supporting a web based application and your developers or operations staff need access to log data
quickly in order to troubleshoot live issues, you need a solution that is able to monitor changes to log files in
near real-time.  If you are using a file replication based approach where files are replicated to a central server
on a fixed schedule, then you can only inspect logs as frequently as the replication runs.  A one minute rsync cron
job might not be fast enough when your site is down and you are waiting for the relevant log data to be replicated.&lt;/p&gt;

&lt;p&gt;On the other hand, if you need to analyze log data offline for calculating metrics or other batch related work,
a file replication strategy might be a good fit.&lt;/p&gt;

&lt;h3 id=&#34;transport:a45c0fcecce9d83887cd906ffc8b7137&#34;&gt;Transport&lt;/h3&gt;

&lt;p&gt;Log data can accumulate quickly on multiple hosts.  Transporting it reliably and quickly to your centralized
location may need additional tooling in order to effectively transmit it and ensure data is not lost.&lt;/p&gt;

&lt;p&gt;Frameworks such as &lt;a href=&#34;https://github.com/facebook/scribe&#34;&gt;Scribe&lt;/a&gt;, &lt;a href=&#34;http://flume.apache.org/&#34;&gt;Flume&lt;/a&gt;,
&lt;a href=&#34;https://github.com/mozilla-services/heka&#34;&gt;Heka&lt;/a&gt;, &lt;a href=&#34;http://logstash.net/&#34;&gt;Logstash&lt;/a&gt;,
&lt;a href=&#34;http://incubator.apache.org/chukwa/&#34;&gt;Chukwa&lt;/a&gt;, &lt;a href=&#34;http://fluentd.org/&#34;&gt;fluentd&lt;/a&gt;,
&lt;a href=&#34;https://github.com/bitly/nsq&#34;&gt;nsq&lt;/a&gt; and &lt;a href=&#34;http://kafka.apache.org/&#34;&gt;Kafka&lt;/a&gt; are designed for transporting large
volumes of data from one host to another reliably.  Although each of these frameworks addresses the transport
problem, they do so quite differently.&lt;/p&gt;

&lt;p&gt;For example, &lt;a href=&#34;https://github.com/facebook/scribe&#34;&gt;Scribe&lt;/a&gt;, &lt;a href=&#34;https://github.com/bitly/nsq&#34;&gt;nsq&lt;/a&gt;
and &lt;a href=&#34;http://kafka.apache.org/&#34;&gt;Kafka&lt;/a&gt;, require clients to log data via their API.  Typically, application
code is written to log directly to these sources which allows them to reduce latency and improve reliability.  If
you want to centralize typical log file data, you would need something to tail and stream the logs via their respective APIs.
If you control the app that is logging the data you want to collect, these can be much more efficient.&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;http://logstash.net/&#34;&gt;Logstash&lt;/a&gt;, &lt;a href=&#34;https://github.com/mozilla-services/heka&#34;&gt;Heka&lt;/a&gt;,
&lt;a href=&#34;http://fluentd.org/&#34;&gt;fluentd&lt;/a&gt; and &lt;a href=&#34;http://flume.apache.org/&#34;&gt;Flume&lt;/a&gt; provide a number of input
sources but also support natively tailing files and transporting them reliably.  These are a better fit for
more general log collection.&lt;/p&gt;

&lt;p&gt;While &lt;a href=&#34;http://rsyslog.com/&#34;&gt;rsyslog&lt;/a&gt; and &lt;a href=&#34;http://www.balabit.com/network-security/syslog-ng&#34;&gt;Syslog-ng&lt;/a&gt;
are typically thought of as the defacto log collector, not all applications use syslog.&lt;/p&gt;

&lt;h3 id=&#34;storage:a45c0fcecce9d83887cd906ffc8b7137&#34;&gt;Storage&lt;/h3&gt;

&lt;p&gt;Now that your log data is being transfered, it needs a destination.  Your centralized storage system needs
to be able to handle the growth in data over time.  Each
day will add a certain amount of storage that is relative to the number of hosts and processes that are generating
log data.&lt;/p&gt;

&lt;p&gt;How you store things depends on a few things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;How long should it be stored&lt;/em&gt; - If the logs are for long-term, archival purposes and do not require immediate
analysis, &lt;a href=&#34;http://aws.amazon.com/s3/&#34;&gt;S3&lt;/a&gt;, &lt;a href=&#34;http://aws.amazon.com/glacier/&#34;&gt;AWS Glacier&lt;/a&gt;,
or tape backup might be a suitable option since they provide relatively low cost for
large volumes of data.  If you only need a few days or months worth of logs, storing them on some form distributed
storage systems such as &lt;a href=&#34;http://hadoop.apache.org/docs/stable/hdfs_design.html&#34;&gt;HDFS&lt;/a&gt;,
&lt;a href=&#34;http://cassandra.apache.org/&#34;&gt;Cassandara&lt;/a&gt;, &lt;a href=&#34;http://www.mongodb.org/&#34;&gt;MongoDB&lt;/a&gt; or
&lt;a href=&#34;http://elasticsearch.org&#34;&gt;ElasticSearch&lt;/a&gt; also works well.  If you only need a few
hours worth of retention for real-time analysis, &lt;a href=&#34;http://redis.io&#34;&gt;Redis&lt;/a&gt; might work as well.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;em&gt;Your environments data volume&lt;/em&gt;. -  A days worth of logs for Google is much different than a days worth of logs for
ACME Fishing Supplies.  The storage system you chose should allow you to scale-out horizontally if your
data volume will be large.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;em&gt;How will you need to access the logs&lt;/em&gt; - Some storage is not suitable for real-time or even batch analysis.
AWS Glacier or tape backup can take hours to load a file.  These don&amp;rsquo;t work if you need log access for production
troubleshooting.  If you plan to do more interactive data analysis,
storing log data in &lt;a href=&#34;http://elasticsearch.org&#34;&gt;ElasticSearch&lt;/a&gt; or &lt;a href=&#34;http://hadoop.apache.org/docs/stable/hdfs_design.html&#34;&gt;HDFS&lt;/a&gt;
may allow you work with the raw data more effectively.  Some log data is
so large that it can only be analyzed in more batch oriented frameworks.  The defacto standard is this case is &lt;a href=&#34;http://hadoop.apache.org/&#34;&gt;Apache Hadoop&lt;/a&gt; along
with &lt;a href=&#34;http://hadoop.apache.org/docs/stable/hdfs_design.html&#34;&gt;HDFS&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;analysis:a45c0fcecce9d83887cd906ffc8b7137&#34;&gt;Analysis&lt;/h3&gt;

&lt;p&gt;Once your logs are stored on a centralized storage platform, you need a way to analyze them.  The most common approach
is a batch oriented process that runs periodically.  If you are storing log data in
&lt;a href=&#34;http://hadoop.apache.org/docs/stable/hdfs_design.html&#34;&gt;HDFS&lt;/a&gt;, &lt;a href=&#34;http://hive.apache.org/&#34;&gt;Hive&lt;/a&gt;
 or &lt;a href=&#34;http://pig.apache.org/&#34;&gt;Pig&lt;/a&gt; might
help analyzing the data easier than writing native MapReduce jobs.&lt;/p&gt;

&lt;p&gt;If you need a UI for analysis, you can store parsed log data in &lt;a href=&#34;http://elasticsearch.org&#34;&gt;ElasticSearch&lt;/a&gt;
and use a front-end such as &lt;a href=&#34;http://kibana.org/&#34;&gt;Kibana&lt;/a&gt; or &lt;a href=&#34;http://graylog2.org/&#34;&gt;Graylog2&lt;/a&gt;
to query and inspect the data.  The log parsing can be handled by &lt;a href=&#34;http://logstash.net/&#34;&gt;Logstash&lt;/a&gt;,
&lt;a href=&#34;https://github.com/mozilla-services/heka&#34;&gt;Heka&lt;/a&gt; or applications logging with JSON
directly.  This approach allows more real-time, interactive access to the data but is not really suited for a mass
batch processing.&lt;/p&gt;

&lt;h3 id=&#34;alerting:a45c0fcecce9d83887cd906ffc8b7137&#34;&gt;Alerting&lt;/h3&gt;

&lt;p&gt;The last component that is sometimes nice to have is the ability to alert on log patterns or calculated metrics
based on log data.  Two common uses for this are error reporting and monitoring.&lt;/p&gt;

&lt;p&gt;Most log data is not interesting but errors almost always indicate a problem.  It&amp;rsquo;s much more effective
to have the logging system email or notify respective parties when errors ocurr instead of having someone repeatedly
watch for the events.  There are several services that solely provide application error logging such as
&lt;a href=&#34;https://www.getsentry.com/&#34;&gt;Sentry&lt;/a&gt; or &lt;a href=&#34;https://www.honeybadger.io/&#34;&gt;HoneyBadger&lt;/a&gt;.  These can also
aggregate repetitve exceptions which can give you and idea of how frequently an error is occuring.&lt;/p&gt;

&lt;p&gt;Another use case is monitoring.  For example, you may have hundreds of web servers and want to know if they start
returning 500 status codes.  If you can parse your web log files and record a metric on the status code, you can then trigger
alerts when that metric crosses a certain threshold.   &lt;a href=&#34;http://riemann.io&#34;&gt;Riemann&lt;/a&gt; is designed for detecting
scenarios just like this.&lt;/p&gt;

&lt;p&gt;Hopefully this helps provide a basic model for designing a centralized logging solution for your environment.&lt;/p&gt;
</description>
        </item>
        
        <item>
            <title>Centralized Logging</title>
            <link>http://jasonwilder.com/blog/2012/01/03/centralized-logging/</link>
            <pubDate>Tue, 03 Jan 2012 00:00:00 UTC</pubDate>
            
            <guid>http://jasonwilder.com/blog/2012/01/03/centralized-logging/</guid>
            <description>

&lt;p&gt;Logs are a critical part of any system, they give you insight into what a system is doing as well what
happened.  Virtually every process running on a system generates logs in some form or another.
Usually, these logs are written to files on local disks.   When your system grows to multiple hosts,
managing the logs and accessing them can get complicated.  Searching for a particular error across
hundreds of log files on hundreds of servers is difficult without good tools.  A common approach to
this problem is to setup a centralized logging solution so that multiple logs can be aggregated in
a central location.&lt;/p&gt;

&lt;p&gt;So what are your options?&lt;/p&gt;

&lt;h3 id=&#34;file-replication:f034079baf6de821e361a928dc85da81&#34;&gt;File Replication&lt;/h3&gt;

&lt;p&gt;A simple approach is to setup file replication of your logs to a central server on a cron schedule.  Usually rsync and
cron are used since they are simple and straightforward to setup.  This solution can work for a while but it doesn&amp;rsquo;t
provide timely access to log data.  It also doesn&amp;rsquo;t aggregate the logs and only co-locates them.&lt;/p&gt;

&lt;h3 id=&#34;syslog:f034079baf6de821e361a928dc85da81&#34;&gt;Syslog&lt;/h3&gt;

&lt;p&gt;Another option that you probably already have installed is &lt;a href=&#34;http://en.wikipedia.org/wiki/Syslog&#34;&gt;syslog&lt;/a&gt;.
Most people use &lt;a href=&#34;http://rsyslog.com/&#34;&gt;rsyslog&lt;/a&gt; or &lt;a href=&#34;http://www.balabit.com/network-security/syslog-ng&#34;&gt;
syslog-ng&lt;/a&gt; which are two syslog implementations.  These daemons allow processes to send log messages to them and the
syslog configuration determines how the are stored.  In a centralized logging setup, a central syslog daemon is setup
on your network and the client logging dameons are setup to forward messages to the central daemon.  A good write-up
of this kind of setup can be found at:
&lt;a href=&#34;http://urbanairship.com/blog/2010/10/05/centralized-logging-using-rsyslog/&#34;&gt;Centralized Logging Use Rsyslog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Syslog is great because just about everything uses it and you likely already have it installed on your system.  With a
central syslog server, you will likely need to figure out how to scale the server and make it highly-available.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.balabit.com/network-security/syslog-ng&#34;&gt;syslog-ng&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://urbanairship.com/blog/2010/10/05/centralized-logging-using-rsyslog/&#34;&gt;rsyslog&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;distributed-log-collectors:f034079baf6de821e361a928dc85da81&#34;&gt;Distributed Log Collectors&lt;/h3&gt;

&lt;p&gt;A new class of solutions that have come about have been designed for
high-volume and high-throughput log and event collection.  Most of these solutions are more general purpose
event streaming and processing systems and logging is just one use case that can be solved using them.
All of these have their specific features and differences but their architectures are fairly similar.
They generally consist of logging clients and/or agents on each specific host.  The agents forward logs to a
cluster of collectors which in turn forward the messages to a scalable storage tier.  The idea is that the
collection tier is horizontally scalable to grow with the increase number of logging hosts and messages.  Similarly,
the storage tier is also intended to scale horizontally to grow with increased volume.  This is gross simplification
of all of these tools but they are a step beyond traditional syslog options.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;https://github.com/facebook/Scribe&#34;&gt;Scribe&lt;/a&gt;&lt;/strong&gt; - Scribe is scalable and reliable log aggregation server
used and released by Facebook as open source.  Scribe is written in C++ and uses &lt;a href=&#34;http://thrift.apache.org/&#34;&gt;Thrift&lt;/a&gt;
for the protocol encoding.  Since it uses thrift, virtually any language can work with it.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;https://cwiki.apache.org/FLUME/&#34;&gt;Flume&lt;/a&gt;&lt;/strong&gt; - Flume is an Apache project for collecting,
aggregating, and moving large amounts of log data.  It stores all this data on
&lt;a href=&#34;http://hadoop.apache.org/hdfs/&#34;&gt;HDFS&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;http://logstash.net&#34;&gt;logstash&lt;/a&gt;&lt;/strong&gt; - logstash lets you ship, parse and index logs from any source.  It
works by defining inputs (files, syslog, etc.), filters (grep, split, multiline, etc..) and outputs (elasticsearch,
mongodb, etc..).  It also provides a UI for accessing and searching your logs.  See
&lt;a href=&#34;http://logstash.net/docs/1.0.17/getting-started-centralized&#34;&gt;Getting Started&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;http://wiki.apache.org/hadoop/Chukwa&#34;&gt;Chukwa&lt;/a&gt;&lt;/strong&gt; - Chukwa is another Apache project that collects
logs onto &lt;a href=&#34;http://hadoop.apache.org/hdfs/&#34;&gt;HDFS&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;http://fluentd.org/doc/&#34;&gt;fluentd&lt;/a&gt;&lt;/strong&gt; - Fluentd is similar to logstash in that there are inputs and
outputs for a large variety of sources and destination.  Some of it&amp;rsquo;s design tenets are easy installation and small
footprint.  It doesn&amp;rsquo;t provide any storage tier itself but allows you to easily configure where your logs should be
collected.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;http://incubator.apache.org/kafka/&#34;&gt;kafka&lt;/a&gt;&lt;/strong&gt; - Kafka was developed at LinkedIn for their activity stream
processing and is now an Apache incubator project.  Although Kafka could be used for log collection this is not it&amp;rsquo;s
primary use case.  Setup requires &lt;a href=&#34;http://zookeeper.apache.org/&#34;&gt;Zookeeper&lt;/a&gt;
to manage the cluster state.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;http://graylog2.org/&#34;&gt;Graylog2&lt;/a&gt;&lt;/strong&gt; - Graylog2 provides a UI for searching and analyzing logs.  Logs are
stored in &lt;a href=&#34;http://www.mongodb.org&#34;&gt;MongoDB&lt;/a&gt; and/or &lt;a href=&#34;http://elasticsearch.org&#34;&gt;elasticsearch&lt;/a&gt;.
Graylog2 also provides the &lt;a href=&#34;http://graylog2.org/about/gelf&#34;&gt;GELF&lt;/a&gt; logging format to overcome some issues
with syslog message: 1024 byte limit and unstructured log messages.  If you are logging long stacktraces,
you may want to look into GELF.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;http://www.splunk.com&#34;/&gt;splunk&lt;/a&gt;&lt;/strong&gt; - Splunk is commercial product that has been around for several years.
It provides a whole host of features for not only collecting logs but also analyzing and viewing them.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Update: I wrote a post comparing &lt;a href=&#34;http://jasonwilder.com/blog/2013/11/19/fluentd-vs-logstash/&#34;&gt;Fluentd vs Logstash&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h3 id=&#34;hosted-logging-services:f034079baf6de821e361a928dc85da81&#34;&gt;Hosted Logging Services&lt;/h3&gt;

&lt;p&gt;There are also several hosted &amp;ldquo;logging as a service&amp;rdquo; providers as well.  The benefit of them is that you only need
to configure your syslog forwarders or agents and they manage the collection, storage and access to the logs.  All of
the infrastructure that you have to setup and maintain is handled by them, freeing you up to focus on your application.
Each service provide a simple setup (usuallysyslog forwarding based), an API and a UI to support search and analysis.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://loggly.com/&#34;&gt;loggly&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://papertrailapp.com&#34;&gt;papertrail&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://logentries.com/&#34;&gt;logentries&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I go into more detail how all of these fit together in
&lt;a href=&#34;http://jasonwilder.com/blog/2013/07/16/centralized-logging-architecture/&#34;&gt;Centralized Logging Architecture&lt;/a&gt;.&lt;/p&gt;
</description>
        </item>
        
    </channel>
</rss>
