<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Loggly &#187; Log Management</title>
	<atom:link href="http://www.loggly.com/category/log-management/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.loggly.com</link>
	<description>Log Management in the Cloud</description>
	<lastBuildDate>Wed, 18 Aug 2010 01:38:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A Logging Library for Django &#8211; How We Log at Loggly</title>
		<link>http://www.loggly.com/2010/05/a-logging-library-for-django-how-we-log-at-loggly/</link>
		<comments>http://www.loggly.com/2010/05/a-logging-library-for-django-how-we-log-at-loggly/#comments</comments>
		<pubDate>Sat, 22 May 2010 18:25:54 +0000</pubDate>
		<dc:creator>Raffy</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Log Management]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.loggly.com/?p=1048</guid>
		<description><![CDATA[In my last blog entry, I showed you how you can enable logging in Django 1.2. Now we are going to look at the logging library that we built for Loggly to simplify the task of logging in our own Django application, the Loggly Web interface.
Here is how we log from within our application:
from loggly.logging [...]]]></description>
			<content:encoded><![CDATA[<p>In my last blog entry, I showed you how you can <a href="http://www.loggly.com/2010/05/how-to-enable-logging-in-django-1-2">enable logging in Django 1.2</a>. Now we are going to look at the logging library that we built for Loggly to simplify the task of logging in our own Django application, the Loggly Web interface.</p>
<p>Here is how we log from within our application:</p>
<pre style="display: none;" name="code" class="python">from loggly.logging import *

error({'object':'input','action':'create'})</pre>
<p>That&#8217;s it. The above code creates the following log entry:</p>
<pre style="display: none;" name="code" class="python">Mar 18 15:34:03 app loggly: severity=ERROR,user=logdog_zrlram,request_id=
08BaswoAAQgAADVDG3IAAAAD,object=input,action=create,status=failure</pre>
<p>The logging call expects a dict of key-value pairs. This is to enforce key-value based log entries that make it easy for consumers to understand what a specific value means. Without the inclusion of a key, a value is more or less useless. In the example above, note that I only provided two keys: object, and action. However, the log entry contains a number of other data items. Those items are automatically added to the log entries by our logging library without burdening the developer to explicitly include them.</p>
<p>It is probably time to show you <a href="">Loggly&#8217;s logging library</a>:</p>
<pre style="display: none;" name="code" class="python">import logging
import inspect

DEFAULT_LOGGER = 'loggly_web'
logs = None

def logHelper(rest=None, request=None):

    global logs
    output = list()

    # get the logger
    if not logs:
        logs = logging.getLogger(DEFAULT_LOGGER)

    # Loop through all the stack frames until you find the request
    stack = inspect.stack()
    for frame in stack:
        if frame[0].f_locals.has_key('request'):
            request = frame[0].f_locals['request']
            if request is None:
                continue
            # there is a request object
            if hasattr(request,'user') and hasattr(request.user,'username') and len(request.user.username)>0:
                output.append("user="+str(request.user.username).strip())
            if hasattr(request,'META') and request.META.has_key('UNIQUE_ID'):
                output.append("request_id="+str(request.META['UNIQUE_ID']).strip())
            # we found the request object. Get out of here
            break

    # getting input dictionary and appending
    if rest:
        for key in rest:
            output.append("%s=%s" % (str(key.strip()), str(rest[key]).strip()))

    ret = ",".join(map(str, output))
    return ret

def info(rest=None, user=None):

    msg = logHelper(rest, request)
    logs.info(msg)

def error(rest=None, user=None):

    msg = logHelper(rest, request)
    logs.error(msg)</pre>
<p>Note that this is only an extract. <a href="/wp-content/uploads/2010/04/loggly_logging.py">Download</a> the entire library if you want to use it in your own code. Here are some important things  the code does:</p>
<ul>
<li>line 17 to 29: This part of the code  inspects the call stack to check whether there is an HTTP request object somewhere. The request object contains the username for the session and that is what we automatically extract . This frees the user from manually adding that information to the logging call. Automation is good!</li>
<li>line 26 and 27: We are using <a href="http://httpd.apache.org/docs/2.0/mod/mod_unique_id.html">UNIQUE_IDs</a> in Apache. In order to track a request from the Apache logs down into our application, we include that same ID into our Django logs. This is a huge win for associating Apache logs with our application logs.</li>
<li>line 32 to 24: All the dict entries are added as &#8216;key=value&#8217; pairs to the log entry. So you can log any key you want.</li>
<li>line 39 to 47: These are the calls that you use in your code. Note that you can add a user field, which overwrites the username from the request. In some cases that is necessary and useful.</li>
</ul>
<p>Let us know if you are using our library. I would love to hear back from you. I will post another blog entry later, where I will be talking about how to patch Django itself to do some more logging. We will be looking at how the authentication methods can be extended.</p>
<p>The links:<br />
<a href="/wp-content/uploads/2010/04/django_logging_1.2.patch">Django 1.2 Logging Patch</a><br />
<a href="/wp-content/uploads/2010/04/loggly_logging.py">Loggly Logging Library</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.loggly.com/2010/05/a-logging-library-for-django-how-we-log-at-loggly/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Enable Logging in Django 1.2</title>
		<link>http://www.loggly.com/2010/05/how-to-enable-logging-in-django-1-2/</link>
		<comments>http://www.loggly.com/2010/05/how-to-enable-logging-in-django-1-2/#comments</comments>
		<pubDate>Thu, 20 May 2010 18:35:01 +0000</pubDate>
		<dc:creator>Raffy</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Log Management]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.loggly.com/?p=1011</guid>
		<description><![CDATA[On Monday Django 1.2 was released. At Loggly, we highly anticipated this release. We have been running version 1.2 since the early Alpha releases. During the Alpha times, Simon Willison released a patch and proposal/ticket of how to enable logging in Django applications. It looked like the patch would get included in the main Django [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.loggly.com/wp-content/uploads/2010/05/django-logo-positive.png" alt="Django 1.2" width="250" style="float:right"/>On Monday <a href="http://www.djangoproject.com/weblog/2010/may/17/12/">Django 1.2</a> was released. At Loggly, we highly anticipated this release. We have been running version 1.2 since the early Alpha releases. During the Alpha times, Simon Willison released a <A href="http://github.com/simonw/django/commit/b5227e1ac1d70b1f936ee69d6e347d8148df461e">patch</a> and <a href="http://code.djangoproject.com/ticket/12012">proposal/ticket</a> of how to enable logging in Django applications. It looked like the patch would get included in the main Django branch. Can you imagine how disappointed we were when the we realized that the patch didn&#8217;t make it into the final release?<br />
Well, what we ended up doing was to patch Django with Simon&#8217;s patch. Took me a little while to update the patch to work with the final 1.2 release. If you want to use the patch, <a href="/wp-content/uploads/2010/04/django_logging_1.2.patch">download</a> it here. What you need to do then is patch your Django install with this. So, download the <a href="http://www.djangoproject.com/download/">Django 1.2</a> tar ball and do the following:</p>
<pre style="display: none;" name="code" class="python">tar -xzf Django-1.2.tar.gz
cd Django-1.2
patch -p0 < /tmp/django_logging_1.2.patch
python ./setup.py install</pre>
<p>This will include the patch into your Django distro and install it. As a next step, you configure your application for logging by adding a snippet similar to the following in your settings.py file:</p>
<pre style="display: none;" name="code" class="python">LOGGING = {
    'loggly_feature': {
        'handler': 'logging.handlers.SysLogHandler',
        'address': ('localhost', 514),
        'facility': 'local3',
        'level': 'INFO',
        'format': 'loggly: %(message)s',        # does not include the severity. it's features, baby!
    },
}</pre>
<p>From there you use the following code snippet to log out of your application:</p>
<pre style="display: none;" name="code" class="python">import logging
logs = logging.getLogger('loggly_feature')
logs.error("message")</pre>
<p>More information about how to use the <a href="http://docs.python.org/library/logging.html">logging libraries</a> you find in the Python documentation. It also seems like Django 1.3 will have <a href="http://code.djangoproject.com/ticket/12012">logging</a> built in. From what I can tell, it looks similar to Simon's approach, but it's not quite the same. I'll keep you posted here!</p>
<p>In my next blog post I will show you how we implemented a logging library for Loggly so that we can very easily log from anywhere within our application.</p>
<p><a href="/wp-content/uploads/2010/04/django_logging_1.2.patch">Django 1.2 Logging Patch</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.loggly.com/2010/05/how-to-enable-logging-in-django-1-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Suffering SaaSitash</title>
		<link>http://www.loggly.com/2010/04/suffering-saasitash/</link>
		<comments>http://www.loggly.com/2010/04/suffering-saasitash/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 03:14:55 +0000</pubDate>
		<dc:creator>Kord</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Log Management]]></category>

		<guid isPermaLink="false">http://www.loggly.com/?p=769</guid>
		<description><![CDATA[Dave Rosenberg posted an opinion about cloud based logging yesterday on his Software, Interrupted blog.  Dave starts out by mentioning Gartner predicted IT would spend more money on private cloud than public cloud through 2012.   Here&#8217;s the exact quote from Gartner:
&#8220;Despite the economies of scale offered by public cloud providers, private cloud [...]]]></description>
			<content:encoded><![CDATA[<p>Dave Rosenberg <a href="http://news.cnet.com/8301-13846_3-20002493-62.html?part=rss&#038;tag=feed&#038;subj=Software,Interrupted">posted an opinion about cloud based logging</a> yesterday on his <em>Software, Interrupted</em> blog.  Dave starts out by mentioning <a href="http://www.gartner.com/it/page.jsp?id=1239813">Gartner predicted</a> IT would spend more money on private cloud than public cloud through 2012.   Here&#8217;s the exact quote from Gartner:</p>
<blockquote><p>&#8220;Despite the economies of scale offered by public cloud providers, private cloud services will prevail for the foreseeable future while public cloud offerings mature, according to Gartner, Inc. Through 2012, IT organizations will spend more money on private cloud computing investments than on offerings from public cloud providers.&#8221;</p></blockquote>
<p>This statement is a bit like NASA doing a press release announcing the moon is continuing to orbit the earth.  Wow!  The moon, still here next year? That&#8217;s awesome. <strong>Of course IT is going to spend more money on virutalization for the next few years.</strong> The success of the private cloud can be attributed to the fact virtualization has been around for a good while now, and is finally being pressed into mainstream use behind the firewall.  Shoot, I think I was running <a href="http://www.winehq.org/">Wine</a> on some of my Linux boxes back in the mid-90s, which means virtualization has been commercialized for at least 15 years at the least.  The idea of virtualizing an OS goes back well into the 60s.  Come to think of it, so do I.</p>
<p>The public cloud, specifically IaaS and SaaS, is a grouping of emerging technologies.  We&#8217;re just now starting to figure out how to wield it correctly for new business models.  Poking holes in it at this point is simply rabble rousing by companies who&#8217;s business models are threatened by it and people who don&#8217;t understand it or have a use for it.</p>
<h3 id="toc-its-a-complicance">It&#8217;s a Complicance</h3>
<p>Guy Churchward <a href="http://news.cnet.com/8301-13846_3-20002493-62.html?part=rss&#038;tag=feed&#038;subj=Software,Interrupted">tries to make some good points</a> in his talk with Dave, but at the end of the day, LogLogic is mainly an appliance vendor, and not only do they have big-time COGS to worry about, they also have to figure out how exactly a cloud customer is going to deploy their box on Amazon&#8217;s EC2 service.  (Hint: They aren&#8217;t.)  While you might be able to send logs back out of the cloud to an appliance behind the firewall, it&#8217;s unlikely to make economical sense to do so in the long term.</p>
<p><a rel="prettyPhoto" href="http://www.loggly.com/wp-content/uploads/2010/04/IMG_0662.jpg"><img src="http://www.loggly.com/wp-content/uploads/2010/04/IMG_0662.jpg" title="South Beach Cafe doesn't like dogs." width="225" height="300" class="alignright size-full wp-image-312"></a></p>
<p>While there is a valid point in calling out cloud concerns, security itself is ALWAYS a concern, regardless of whether you run in the cloud or in your own datacenter.  Frankly, with Loggly I&#8217;m likely  better at storing and securing your logs than you are by yourself in your own data center, mostly due to the fact I&#8217;m under pressure by multiple people like you to provide a service which is expected at the outset to be secure.  It&#8217;s no different than the pressure that Google has on them for securing your email, SalesForce for securing your leads, or Amazon securing your credit card info.  We&#8217;re all culpable here for the security of your data.</p>
<p>Additionally, not all that cloudy data is created equal.  A lot of the companies running in the cloud today are web based app companies, and the data they generate is often times very public in nature and not at all affected by compliance concerns.  Do you think some user on Flickr cares if I stole all their comments?  What about getting access to all those <a href="http://twitter.com/kordless">juicy tweets</a> of mine?  Oh wait, those <a href="http://www.reuters.com/article/idUS156257560820100414?feedType=RSS&#038;feedName=wiredStartUps">are already in the Library of Congress</a>.  Nevermind, false alarm!</p>
<h3 id="toc-when-it-rains-it-pours">When IT Rains IT Pours</h3>
<p>Log file data is already one of the largest sets of data on the planet.   Logging alone in the public cloud is going to be absolutely staggering over the next few years.  These trends are being driven by people switching to SaaS based applications, in turn who&#8217;s infrastructure either requires the elastic capabilities only the public cloud can provide, or who&#8217;s price point can&#8217;t be matched by private cloud offerings.</p>
<p>The elastic nature of these infrastructures means the logs which they generate need to be collected and stored in centralized location before the box that generated them disappears.  There are many types of logs which are valuable to a company for understanding their business, and not so valuable for those data-thieving ruffians everyone keeps talking about.</p>
<p>While the security access data or net-flow information from public cloud vendors might alleviate the concerns of some consumers, I think there are much higher value adds to these offerings by being able to power availability and analytics services around a company&#8217;s application via a log file storage platform.</p>
<p>While the private cloud may continue to orbit peacefully for the next few years, the use of it for web based services will decay eventually, and it&#8217;ll be regulated to the more mundane stuff like storing my dental records and tracking my orders over on <a href="http://radiatorbarn.com/">RadiatorBarn.com</a>.</p>
<p>BTW, I&#8217;m still waiting on my radiator, Burton.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loggly.com/2010/04/suffering-saasitash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visualizing your Data in the Cloud with Loggly and HighCharts</title>
		<link>http://www.loggly.com/2010/03/visualizing-your-data-in-the-cloud-with-loggly-and-highcharts/</link>
		<comments>http://www.loggly.com/2010/03/visualizing-your-data-in-the-cloud-with-loggly-and-highcharts/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 22:39:30 +0000</pubDate>
		<dc:creator>Raffy</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Log Management]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[loggly]]></category>
		<category><![CDATA[mashup]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://www.loggly.com/?p=694</guid>
		<description><![CDATA[A short while into writing code for the Loggly interface we decided that we needed some eye candy. Given my background in visualization, I was keen on providing our users with an experience that helps them understand their data in an intuitive way.
Over the last few years I&#8217;ve been looking into a ton of visualization [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.loggly.com/wp-content/uploads/2010/03/Screen-shot-2010-03-26-at-Mar-26-6.32.05-PM.png"><img width=680 title="Loggly Cloud Data" src="http://www.loggly.com/wp-content/uploads/2010/03/Screen-shot-2010-03-26-at-Mar-26-6.32.05-PM.png" alt="" /></a></p>
<p>A short while into writing code for the Loggly interface we decided that we needed some eye candy. Given my <a href="http://secviz.org">background</a> in visualization, I was keen on providing our users with an experience that helps them understand their data in an intuitive way.</p>
<p>Over the last few years I&#8217;ve been looking into a ton of visualization libraries for the Web.  In the past, if you had asked me what library to use for generating charts on your Web site, I would have said, &#8220;Use Flash&#8221;.  While there are a number of interesting Flash libraries out there, the landscape has shifted significantly in the last year.  Everyone is moving to JavaScript. After some research, I opted to use a <a href="http://www.datavisualization.ch/tools/13-javascript-libraries-for-visualizations">JavaScript charting library</a> called <a href="http://highcharts.com/">HighCharts</a>.   I tried a bunch of other canvas-based libraries, but let me tell you without hesitation, HighCharts rocks.</p>
<p>I am going to show you how we are using HighCharts and how I implemented <em><strong>zooming to dynamically reload more event data</strong></em> on the fly.  With any charting library, if you keep zooming in on a chart, it will not progressively load more detailed data.  At detailed zoom levels you end up with a small range of data in your graph.  Basically if you view a day&#8217;s data first, and then zoom into a specific minute, you would only see one data point.</p>
<p>To start, here&#8217;s the JavaScript I use to display a chart:</p>
<pre name="code" class="javascript">var parse_date = function(data) {
    var result = [];
    $.each(data, function(key, value) {
        var re = new RegExp(/(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)(?:\.(\d+))?/);
        var date = re.exec(key);
        if (date[7] == undefined) {date[7]=0;}
        var real_date = Date.UTC(date[1], parseInt(date[2])-1,date[3],date[4],date[5],date[6],date[7]);
        result.push([real_date, value]);
    });
    return result;
}

chart = new Highcharts.Chart({
    credits: { enabled: false },
    chart: {
        renderTo: 'activity',
        defaultSeriesType: 'area',
        margin: [10, 20, 40, 55],
        zoomType: "x",
            events: {
                selection: function(event) {
                    // change the time frame to be searched
                    var start = Highcharts.dateFormat('%Y-%m-%dT%H:%M:%SZ', event.xAxis[0].min);
                    var end = Highcharts.dateFormat('%Y-%m-%dT%H:%M:%SZ', event.xAxis[0].max);
                    $.ajax({ type: "GET", url: "http://subdomain.loggly.com/api/search/?" \
                        + "q=inputname:logglyapp&#038;starttime="+start+"&#038;endtime="+end \
                        + "&#038;facets=True&#038;buckets=24",
                        success: function(data) {
                             chart.xAxis[0].setExtremes();
                             chart.series[0].setData(parse_date(data));
                             // fix the reset zoom button
                             $('.highcharts-toolbar').click(resetZoom);
                        },
                        error: function(req, text, error) {
                            $("#err").html("Reload error!");
                        }
                    });
                }
        }
    },
    xAxis: { title: { text: 'Time' }, type: 'datetime' },
    yAxis: { title: { text: '# Events' }, min:0,
        plotLines: [{ value: 0, width: 1, color: '#808080' }]
    },
    tooltip: { formatter: function() {
            return Highcharts.dateFormat('%B %e %Y %H:%M:%S', this.x) + '<br/>'+
            '<b>'+this.y+' Events</b>' }},
    plotOptions: {
        area: {
            dataParser: parse_date,
        }
    },
    series: [{ id: 1, name: 'search',
        dataURL: 'http://subdomain.loggly.com/api/search/'
            + '?q=inputname:logglyapp&#038;facets=True'}],
    title: { text: 'traffic last 24 hours' }
});

var reset_zoom = function() {
    // requery for the original data:
    $.ajax({ type: "GET", url: "http://subdomain.loggly.com/api/search/"
        + "?q=inputname:logglyapp&#038;facets=True",
        success: function(data) {
           chart.toolbar.remove('zoom');
           chart.xAxis[0].setExtremes();
           chart.get(1).setData(parse_date(data));
        },
        error: function(req, text, error) {
            $("#err").html("Loading error!");
        }
    });
}
});
</script>
</pre>
<p>Let&#8217;s have a quick look at the code. There are two things I want to communicate here: 1. The code I used to display a HightChart graph and 2. The way I am using <a href="http://wiki.loggly.com/api-documentation">Loggly&#8217;s APIs</a> to query the data.</p>
<p>I mentioned the special zooming that I implemented. Take a look at lines 20 to 39.  This is the function that handles zooming, and it is where I am reloading the more detailed data.  I set the new start and end dates (lines 23 and 24) and then I am querying the Loggly API with the new timeframe (lines 25 to 27). Upon success &#8211; this is important &#8211; I am using the <b>chart.series[0].setData()</b> method to set the new data for the chart. The next line overwrites the default button or a link that lets the user zoom out again (lines 32). Note: because you are implementing your own zoom, the default &#8220;reset zoom&#8221; button from HighCharts will not work anymore and you have to implement your overwrite it with your own function to reset the chart.</p>
<p>The function dealing with the reset functionality is on lines 59 to 72. It does nothing else than query the Loggly API for the original data (I am passing no time parameters) and setting the data just like the previous call. The other thing you have to do is in lines 64 where you need to remove the HighCharts default &#8220;reset zoom&#8221; link and reset the extremes (line 65).
<p>Moving on, we&#8217;ll briefly discuss the way I&#8217;m using the <B>Loggly API</B>.  If you&#8217;d like to use it, you need an account with us. We are currently in private beta, therefore you will need us to give you access to the beta program in order to do so. <a href="mailto:support@loggly.com?subject=BETA+request+for+API+usage">Email</a> if you want an account to play around with! Back to the code. Make sure you replace the <subdomain> with your actual subdomain. Now that this is out of the way, you can query the API by simply making a GET request to: /api/search. You pass the <b>q</b> parameter with your query. In my example I am getting all the data from my input with the name <i>logglyapp</i>. To get timeline data, you&#8217;ll need to pass the parameter <b>facets=True</b> into the call. This will give you counts for time buckets.</p>
<p>To make everything work together, you need one more piece: the <b>date_parse</b> function.  You need this part because the Loggly API returns the data with real human readable timestamps and HighCharts wants UTC encoded timestamps. The function on lines 1 to 11 takes care of converting the time for you. Just copy it.</p>
<p>I hope this was useful. Let us know if you are having trouble with any of this. We are looking forward hearing about your graphing endeavors.</p>
<p>If you look at my <a href="http://del.icio.us/zrlram/visualization">del.icio.us</a> feed, you&#8217;ll find a bunch more visualization and charting links.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loggly.com/2010/03/visualizing-your-data-in-the-cloud-with-loggly-and-highcharts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Fixing Client IPs in Apache Logs with Amazon Load Balancers</title>
		<link>http://www.loggly.com/2010/03/fixing-client-ips-in-apache-logs-with-amazon-load-balancers/</link>
		<comments>http://www.loggly.com/2010/03/fixing-client-ips-in-apache-logs-with-amazon-load-balancers/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 23:09:07 +0000</pubDate>
		<dc:creator>Raffy</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Log Management]]></category>

		<guid isPermaLink="false">http://www.loggly.com/?p=681</guid>
		<description><![CDATA[If you are running your Web servers behind a load balancer, you have probably noticed that your logs contain the load balancer&#8217;s IP address as the client IP, which is kind of annoying. There is an Apache module called RPAF, which fixes exactly this issue. Once you have it downloaded and installed, you configure it [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.loggly.com/wp-content/uploads/2010/03/images.jpg" alt="" title="Balancing Act" width="124" height="93" class="alignright size-full wp-image-683" />
<p>If you are running your Web servers behind a load balancer, you have probably noticed that your logs contain the load balancer&#8217;s IP address as the client IP, which is kind of annoying. There is an Apache module called <a href="http://stderr.net/apache/rpaf/">RPAF</a>, which fixes exactly this issue. Once you have it downloaded and installed, you configure it as follows:</p>
<pre name="code" class="bash:nocontrols">RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1 10.0.0.1
RPAFheader X-Forwarded-For</pre>
<p>The module works such that it takes the IP address that is being transmitted in the X-FORWARD-FOR header and sticks it into the request as the ClientIP.</p>
<p>The not so nice part is that the RPAFproxy_ips statement lets you define the IP addresses of your load balancer. If you have only a set amount of them, all is fine. But here comes the catch. If you are deployed on Amazon AWS and you are using their load balancer (LB), then this solution is going to frustrate you quite a bit. You will notice that the LB&#8217;s IP address changes constantly and you keep adding IP addresses to the configuration statement. After about 10 IP addresses, I got sick of that and I started looking at the source code of RPAF to solve this problem once and for all. Here is what I did:</p>
<p>On line 139 of mod_rpaf-2.0.c, I added a <B>return 1;</B> statement. This will tell the is_in_array() function to always assume that the request is coming from a load balancer, without checking the configured list of IP addresses. The rest of the RPAF code is robust enough to only replace the client ip when an X-FORWARD-FOR header is actually set. After the change, do a <b>make install-2.0</b> and you are in business.</p>
<p>Happy logging!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loggly.com/2010/03/fixing-client-ips-in-apache-logs-with-amazon-load-balancers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>RSA Security Conference – Cloud the Logging Killer App?</title>
		<link>http://www.loggly.com/2010/03/569/</link>
		<comments>http://www.loggly.com/2010/03/569/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 22:43:43 +0000</pubDate>
		<dc:creator>Raffy</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Log Management]]></category>

		<guid isPermaLink="false">http://www.loggly.org/?p=569</guid>
		<description><![CDATA[I am attending the RSA conference this week. The first session I attended was the Cloud Security Alliance (CSA) meeting. Reading some of the accompanying material and listening to some of the presentations and panels, I couldn&#8217;t help it but notice that the terms auditing and logging were all over.
Here is my attempt for an [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_336" class="wp-caption alignright" style="width: 210px"><img style="align:right" title="Logging" src="http://raffy.ch/blog/wp-content/uploads/2010/03/Screen-shot-2010-03-01-at-Mar-1-2.36.46-PM.png" alt="Logging - Cloud Kiler App" width="200" /><p class="wp-caption-text">Logging</p></div>
<p>I am attending the <a href="http://www.rsaconference.com">RSA conference</a> this week. The first session I attended was the <a href="http://cloudsecurityalliance.org">Cloud Security Alliance</a> (CSA) meeting. Reading some of the accompanying material and listening to some of the presentations and panels, I couldn&#8217;t help it but notice that the terms <strong>auditing</strong> and <strong>logging</strong> were all over.</p>
<p>Here is my attempt for an explanation of this. It seems that one of the reasons for this is the nature of the cloud. Think about it. You are in an environment where you don&#8217;t control much. You are in an environment where you cannot trust most of the infrastructure pieces. For example, if you are using AWS like we are doing at <a href="http://loggly.com">Loggly</a>, you should generally not trust your AMIs (the OS images). Now, what do you do if you don&#8217;t trust someone? You observe them, you monitor them. That&#8217;s exactly what is and needs to happen in the cloud: You don&#8217;t trust the service. To mitigate this issue, you are going to monitor the service.</p>
<p>And to make this not just my explanation, here is what some panelists during the CSA meeting said:</p>
<p><cite>&#8220;Loss of visibility in the cloud&#8221; &#8211; Scott Chasin, CTO McAfee SaaS Unit</cite><br />
<cite>&#8220;Lose control and still maintain accountability&#8221; &#8211; Ken Biery, Verizon Business.</cite></p>
<p>Is the cloud the killer app for logging? And if that&#8217;s the case, how do you manage your logs in the cloud? There are hardly any cloud logging solutions out there. I think you see <a href="http://www.loggly.com">where</a> I am going with this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loggly.com/2010/03/569/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
