<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[@sharmin.anee - Medium]]></title>
        <description><![CDATA[AWS ELB Logs from S3 on ELK stack - Medium]]></description>
        <link>https://medium.com/sharmin-anee?source=rss----e054353f6ca9---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>@sharmin.anee - Medium</title>
            <link>https://medium.com/sharmin-anee?source=rss----e054353f6ca9---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 13:19:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/sharmin-anee" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AWS ELB Logs from S3 on ELK stack]]></title>
            <link>https://medium.com/sharmin-anee/aws-elb-logs-from-s3-on-elk-stack-c463e2e2ec0?source=rss----e054353f6ca9---4</link>
            <guid isPermaLink="false">https://medium.com/p/c463e2e2ec0</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[elb]]></category>
            <category><![CDATA[logstash]]></category>
            <category><![CDATA[kibana]]></category>
            <dc:creator><![CDATA[Sharmin Akter]]></dc:creator>
            <pubDate>Mon, 23 Oct 2017 02:59:35 GMT</pubDate>
            <atom:updated>2017-10-23T04:25:34.290Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*NZ6O_iBWnXO8mxca." /><figcaption><strong>ELK Stack Architecture</strong></figcaption></figure><p>The ELK stack stands for Elasticsearch, Logstash and Kibana. ELK is a popular open source solution for searching, analyzing and visualizing data.</p><p>Elasticsearch is an open-source full-text search and analytics engine ( based on Lucene) used to store, search and analyze big volumes of data quickly and in real time.</p><p>Logstash is a data processing pipeline for managing event logs.</p><p>Kibana is a web application for visualizing data in Elasticsearch.</p><p>On the other hand, AWS ELB logs provide detailed information (like client’s IP address, latencies, request paths server responses etc.) about requests sent to your load balancer. So it’s important to monitor access logs. We’ll do this using ELK stack here.</p><p><strong>Prerequisites:</strong></p><ul><li>EC2 instance (Debian-8 server)</li><li>Minimum 3GB Memory</li><li>By default, ELB logging is turned off — so enable ELB logging to S3 bucket.</li></ul><p><strong>Start with Java-8</strong></p><p>Add the Webupd8 Oracle Java PPA repository on “/etc/apt/sources.list.d/java-8-debian.list”</p><pre>deb <a href="http://ppa.launchpad.net/webupd8team/java/ubuntu">http://ppa.launchpad.net/webupd8team/java/ubuntu</a> trusty main</pre><pre>deb-src <a href="http://ppa.launchpad.net/webupd8team/java/ubuntu">http://ppa.launchpad.net/webupd8team/java/ubuntu</a> trusty main</pre><p>Import GPG key on your system for validating packages</p><pre>sudo apt-key adv — keyserver keyserver.ubuntu.com — recv-keys EEA14886</pre><p>Update your system and install Oracle Java 8</p><pre>sudo apt-get update</pre><pre>sudo apt-get install oracle-java8-installer -y</pre><p>Set up Java Environment Variables:</p><pre>echo “JAVA_HOME=’/usr/lib/jvm/java-8-oracle’” &gt;&gt; /etc/environment</pre><pre>source /etc/environment</pre><pre>export JAVACMD=`which java`</pre><p><strong>Get ElasticSearch:</strong></p><p>Download Latest ElasticSearch from <a href="https://www.elastic.co/downloads/elasticsearch">here</a></p><p>Here we are using elasticsearch-5.6.3</p><pre>wget <a href="https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.3.deb">https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.3.deb</a></pre><pre>sudo dpkg -i elasticsearch-5.6.3.deb</pre><pre>sudo systemctl daemon-reload; sudo systemctl enable elasticsearch</pre><pre>sudo systemctl restart elasticsearch; sudo systemctl status elasticsearch</pre><pre>curl localhost:9200</pre><p>You can configure Elasticsearch by changing its config file located on “/etc/elasticsearch/elasticsearch.yml”</p><p><strong>Install Elasticsearch Plugins for AWS:</strong></p><p>The Elasticsearch “<a href="https://www.elastic.co/guide/en/elasticsearch/plugins/current/cloud-aws.html">cloud-aws</a>” plugin has been split into two separate plugins:</p><ul><li>EC2 Discovery Plugin (discovery-ec2)</li><li>S3 Repository Plugin (repository-s3)</li></ul><pre>sudo update-ca-certificates -f</pre><pre>cd /usr/share/elasticsearch/</pre><pre>sudo bin/elasticsearch-plugin install discovery-ec2</pre><pre>sudo bin/elasticsearch-plugin install repository-s3</pre><p>To list your elasticsearch plugins:</p><pre>sudo bin/elasticsearch-plugin list</pre><p><strong>Get Kibana:</strong></p><p>Download Latest Kibana from <a href="https://www.elastic.co/downloads/kibana">here</a></p><pre>wget <a href="https://artifacts.elastic.co/downloads/kibana/kibana-5.6.3-amd64.deb">https://artifacts.elastic.co/downloads/kibana/kibana-5.6.3-amd64.deb</a></pre><pre>sudo dpkg -i kibana-5.6.3-amd64.deb</pre><pre>sudo update-rc.d kibana defaults 95 10</pre><pre>sudo systemctl daemon-reload; sudo systemctl enable kibana</pre><pre>sudo systemctl start kibana; sudo systemctl status kibana</pre><p><strong>Get Logstash:</strong></p><p>Download Latest Logstash from <a href="https://www.elastic.co/downloads/logstash">here</a></p><pre>wget <a href="https://artifacts.elastic.co/downloads/logstash/logstash-5.6.3.deb">https://artifacts.elastic.co/downloads/logstash/logstash-5.6.3.deb</a></pre><pre>sudo dpkg -i logstash-5.6.3.deb</pre><pre>sudo systemctl daemon-reload; sudo systemctl enable logstash</pre><pre>sudo systemctl restart logstash; sudo systemctl status logstash</pre><p><strong>Install Nginx:</strong></p><pre>sudo apt-get install -y nginx apache2-utils</pre><p>Set password for your web page</p><pre>sudo htpasswd -c /etc/nginx/htpasswd.users admin</pre><p>Configure Nginx to use Kibana on through “/etc/nginx/sites-available/default” file</p><p>Add authentication you set before</p><pre>auth_basic “Restricted Access”;</pre><pre>auth_basic_user_file /etc/nginx/htpasswd.users;</pre><p>And then add location access details:</p><pre>location / {</pre><pre>proxy_pass <a href="http://localhost:5601;">http://localhost:5601;</a></pre><pre>proxy_http_version 1.1;</pre><pre>proxy_set_header Upgrade $http_upgrade;</pre><pre>proxy_set_header Connection ‘upgrade’;</pre><pre>proxy_set_header Host $host;</pre><pre>proxy_cache_bypass $http_upgrade;</pre><pre>}</pre><p>Now restart your web server to get the changes and check on browser.</p><p><strong>Configure Logstash:</strong></p><p>Input configuration file on “/etc/logstash/conf.d/input.conf”</p><pre>input {</pre><pre>s3 {</pre><pre>bucket =&gt; “<strong><em>Your_Bucket_Name</em></strong>”</pre><pre>prefix =&gt; “<strong><em>prefix_of_cloudwatch_log_folde</em></strong>r”</pre><pre>region =&gt; “<strong><em>your_region</em></strong>”</pre><pre>type =&gt; “<strong>elblogs</strong>”</pre><pre>codec =&gt; plain</pre><pre>secret_access_key =&gt; “<strong><em>AWS_ACCESS_KEY</em></strong>”</pre><pre>access_key_id =&gt; “<strong><em>AWS_SECRET_KEY</em></strong>”</pre><pre>}</pre><pre>}</pre><p>To filter elblogs using “/etc/logstash/conf.d/filter.conf”</p><pre>filter {<br>if [type] == “<strong>elblogs</strong>” {<br>grok {<br>match =&gt; [“message”, “%{TIMESTAMP_ISO8601:timestamp} %{NOTSPACE:elb_name} %{IP:elb_client_ip}:%{INT:elb_client_port:int} (?:%{IP:elb_backend_ip}:%{NUMBER:elb_backend_port:int}|-) %{NUMBER:request_processing_time:float} %{NUMBER:backend_processing_time:float} %{NUMBER:response_processing_time:float} (?:%{INT:elb_status_code:int}|-) (?:%{INT:backend_status_code:int}|-) %{INT:elb_received_bytes:int} %{INT:elb_sent_bytes:int} \”(?:%{GREEDYDATA:elb_request}|-)\” \”(?:%{GREEDYDATA:userAgent}|-)\” %{NOTSPACE:elb_sslcipher} %{NOTSPACE:elb_sslprotocol}”]<br>match =&gt; [“message”, “%{GREEDYDATA:event_name} for ELB: %{NOTSPACE:elb_name} at %{TIMESTAMP_ISO8601:timestamp}”]<br>}<br>if [elb_request] =~ /.+/ {<br>grok {<br>match =&gt; [“elb_request”, “(?:%{WORD:http_method}) (?:%{DATA:http_path})? (?:%{DATA:http_type}/%{NUMBER:http_version:float})?|%{GREEDYDATA:rawrequest}”]<br>}<br>}<br>if [http_path] =~ /.+/ {<br>grok {<br>match =&gt; [“http_path”, “(?:%{WORD:http_path_protocol}://)?(%{NOTSPACE:http_path_site}:)?(?:%{NUMBER:http_path_port:int})?(?:%{GREEDYDATA:http_path_url})?”]<br>}<br>}<br>geoip {<br>source =&gt; “elb_client_ip”<br>}<br>}<br>date {<br>match =&gt; [ “timestamp”, “ISO8601” ]<br>}<br>}</pre><p>Output configuration file on “/etc/logstash/conf.d/output.conf” using your desired index_name</p><pre>output {<br> stdout { codec =&gt; rubydebug }<br> elasticsearch {<br> hosts =&gt; [“localhost:9200”]<br> index =&gt; “<strong><em>index_name</em></strong>”<br> }<br>}</pre><p>You can check your configurations by</p><pre>sudo service logstash configtest</pre><p>Now restart logstash</p><pre>sudo systemctl restart logstash</pre><p>Check your index should be created now</p><pre>curl -XGET localhost:9200/_cat/indices?v</pre><p>Now navigate to your browser to access Kibana Dashboard and create index using your “index_name”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*JwnDsID4HBIfdiU5." /><figcaption><strong>Adding index in Kibana</strong></figcaption></figure><p>Finally, you can visualize in the ‘Discover’ menu by selecting your desired time frame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*zGw_40sGOZqxAuw0." /><figcaption><strong>Kibana dashboard records</strong></figcaption></figure><p>That’s it! Your ELK stack is installed and operational with S3 ELB logs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c463e2e2ec0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sharmin-anee/aws-elb-logs-from-s3-on-elk-stack-c463e2e2ec0">AWS ELB Logs from S3 on ELK stack</a> was originally published in <a href="https://medium.com/sharmin-anee">@sharmin.anee</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>