<?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[Stories by Saurabh Gupta on Medium]]></title>
        <description><![CDATA[Stories by Saurabh Gupta on Medium]]></description>
        <link>https://medium.com/@saurabhgupta_43828?source=rss-119fcd0387a9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YbMd1D2xnr1gbO4v.</url>
            <title>Stories by Saurabh Gupta on Medium</title>
            <link>https://medium.com/@saurabhgupta_43828?source=rss-119fcd0387a9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 09:31:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saurabhgupta_43828/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Fluentd Cookbook for Chefs]]></title>
            <link>https://medium.com/@saurabhgupta_43828/fluentd-cookbook-for-chefs-a4121d955d9e?source=rss-119fcd0387a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4121d955d9e</guid>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[fluentd]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[logging]]></category>
            <dc:creator><![CDATA[Saurabh Gupta]]></dc:creator>
            <pubDate>Wed, 11 Apr 2018 12:45:18 GMT</pubDate>
            <atom:updated>2018-04-11T12:45:18.722Z</atom:updated>
            <content:encoded><![CDATA[<p>Often you find yourself in a situation, where finding bugs becomes a tedious process and you start looking for some central logging solution. Now, fluentd might be the first choice for such situations, but setting it up is really painful and time taking. Therefore, following is a guide to setup fluentd on your systems using a chef development kit and the cookbook code at the following link:</p><p><a href="https://github.com/plotlabs/chef-cookbooks/tree/master/fluentd">https://github.com/plotlabs/chef-cookbooks/tree/master/fluentd</a></p><p>First of all, you need to install the Chef Development Kit from the official website: <a href="https://downloads.chef.io/chefdk">https://downloads.chef.io/chefdk</a></p><p>Once we are done installing Chef DK and cloning the code from the Github repo, we are good to go for our setup (and by setup, I mean running the following simple command, sit back and relax):</p><pre>chef-client --local-mode -—runlist “fluentd::default”</pre><p>This will set up a logging mechanism listening at PORT 8888 of your local system. To test the setup simply run the following cURL command:</p><pre>curl -X POST -d &#39;json={&quot;json&quot;:&quot;message&quot;}&#39; http://localhost:8888/debug.test</pre><p>The above command means you are sending an object to your fluentd server which is listening on PORT 8888. You can find this log captured in /var/log/td-agent/td-agent.log.</p><p>I hope this was a good read. Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4121d955d9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up application level logs (python and node.js)]]></title>
            <link>https://medium.com/@saurabhgupta_43828/setting-up-application-level-logs-python-and-node-js-9f2ea0ae447f?source=rss-119fcd0387a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f2ea0ae447f</guid>
            <category><![CDATA[fluentd]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[kibana]]></category>
            <category><![CDATA[logs]]></category>
            <dc:creator><![CDATA[Saurabh Gupta]]></dc:creator>
            <pubDate>Thu, 23 Nov 2017 14:32:30 GMT</pubDate>
            <atom:updated>2017-11-23T14:32:30.245Z</atom:updated>
            <content:encoded><![CDATA[<h3>Setting up application level logs (python and node.js) on Elasticsearch, Kibana and Fluentd on an A<strong>mazon Linux AMI 2017.09.1 (HVM)</strong></h3><p>It might look like something which can already be found in many blogs or fluentd docs. So, why bother to write such thing?</p><p>The answer is simple. With the latest update in fluentd, amazon linux ami the previous pieces doesn’t fit. I was trying to set it all up on an AWS EC2 instance using linux-ami-2017.09.1-image for two days to achieve success only after investing so much of my time, trying different things fixing multiple bugs etc. Following is a step by step process to get it all done.</p><p>Step 0: Getting Prerequisites</p><p>Remember changing user to root before doing anything.</p><p><a href="https://docs.fluentd.org/v0.12/articles/before-install">Before Installing Fluentd | Fluentd</a></p><p>Step 1: Installing Fluentd (td-agent)</p><p><a href="https://docs.fluentd.org/v0.12/articles/install-by-rpm#step-1:-install-from-rpm-repository">Installing Fluentd Using rpm Package | Fluentd</a></p><p>Everthing is a piece of cake till here. You’ll be able to run your fluentd server on the machine by simply runnning:</p><pre>/etc/init.d/td-agent start</pre><h4><strong>Note- Do not try to run the fluentd-ui and start daemon from there. It has some issues and will not work. Remember, you have to do it using shell command only.</strong></h4><p>The logs are available at /var/log/td-agent/td-agent.log</p><p>To view real time logs run the following command in your ec2 machine:</p><p>tail -f /var/log/td-agent/td-agent.log</p><p>Once you have your td-agent running, you can send the cURL request to debug:</p><pre>curl -X POST -d &#39;json={&quot;json&quot;:&quot;message&quot;}&#39; http://localhost:8888/debug.test</pre><p>Now you can see this log in your td-agent.log file.</p><p>Step 2: Setting up applications to send logs to fluentd server. Configuring log emission from the application gives you full control on the responses to be logged. Easy customization helps you query those logs based on a certain id or key</p><blockquote><strong>Querying logs?</strong> Yes, that’s why we are here in the first place. The whole aim of this process is to build something which can manage logs in such a way that they are easily accessible.</blockquote><p>Step 2a: <a href="https://www.npmjs.com/package/fluent-logger">Sending logs from a node.js app</a></p><p>Step 2b: <a href="https://github.com/fluent/fluent-logger-python">Sending logs from a python app</a></p><p>Step 3: Fixing bugs</p><p>The things we have discussed so far seems pretty simple and straightforward, no? The real challenge which lead me to write this blog starts here. At this stage, our applications are sending manageable and customized logs and it all is getting recored in a log file (/var/log/td-agent/td-agent.log).</p><p>Now, you look for a way to send those logs to Elasticsearch and visualize them using Kibana. You can find other blogs on setting up your local ES and Kibana env. I will be using AWS Elasticsearch Service for this tutorial.</p><p>First of all, all we need is a Fluentd plugin named aws-elasticsearch-service for the task. It’s not an official plugin so we have to refer multiple sources to get it running fine.</p><p>Step 3a: Fixing dependency issues</p><p>Before installing the plugin you need some ruby header files and developer tools. They all can be installed by running the following commands:</p><pre>sudo yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel</pre><pre>sudo yum install ruby-rdoc ruby-devel</pre><p>At this point, we are ready to install the desired plugin. To install it, run:</p><pre>td-agent-gem install fluent-plugin-aws-elasticsearch-service</pre><p>The command must be run as root user to successfully install the plugin.</p><p>Step 4: Configure Fluentd server to send logs to elasticsearch host</p><p>To configure fluentd, we need to make changes to our config file located at: /etc/td-agent/td-agent.conf. Here, I am just going to explain the elastic search host configuration</p><p>[optional], {required}</p><pre>&lt;match [tagname]**&gt;<br>     @type copy<br>     &lt;store&gt;<br>         @type stdout<br>     &lt;/store&gt;<br>     &lt;store&gt;<br>         @type aws-elasticsearch-service<br>         type_name [placeholder]<br>         logstash_format <strong>true<br>         </strong>include_tag_key <strong>true<br>         </strong>tag_key system_log<br>         flush_interval 0s<br>         &lt;endpoint&gt;<br>             url {elastic search endpoint}<br>             region {endpoint region}<br>             access_key_id [access-key-id]<br>             secret_access_key [access-key]<br>         &lt;/endpoint&gt;<br>     &lt;/store&gt;<br>&lt;/match&gt;</pre><p>The <strong>tagname </strong>field is used as a filter to select what logs to send to elasticsearch. The <strong>placeholder </strong>can be anything.</p><p>While creating an elastic search service instance, we get all the fields required in &lt;endpoint&gt;. That’ all with the setup.</p><blockquote>With this we have our customized application logs and a mechanism to query them to track specific event happening on our apps.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f2ea0ae447f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOLO (An app which does user profiling based on music taste)]]></title>
            <link>https://medium.com/@saurabhgupta_43828/solo-an-app-which-does-user-profiling-based-on-music-taste-6aeda95bbed1?source=rss-119fcd0387a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6aeda95bbed1</guid>
            <category><![CDATA[music]]></category>
            <category><![CDATA[ideas]]></category>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[des360]]></category>
            <dc:creator><![CDATA[Saurabh Gupta]]></dc:creator>
            <pubDate>Sat, 26 Aug 2017 05:31:06 GMT</pubDate>
            <atom:updated>2017-08-26T05:31:06.427Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/331/0*aBmWEoXjvrr1ezI3." /></figure><p>We have created a short survey to know the market feasibility of the app and the features majority of the people want from it. Basically, this app is a hybrid of a music streaming app and a social media network. We call it Solo.</p><p>Based on the survey, we have the following inferences:</p><ol><li>Among the people who filled up the survey form, ~87% are interested in using such an app which propose connection suggestions based on the music taste.</li><li>We also asked the users to mention what all features they’ll be interested in the app to have. Below is a list of most requested features:</li></ol><ul><li>Music Streaming</li><li>Form groups with peers to share music</li><li><strong>Connect to people on the basis of music taste</strong></li><li>Downloadable Songs/offline</li><li><strong>Spotify, Gaana, Saavn, iTunes integration</strong></li><li>Create and share playlist</li><li>Music Recommendations</li><li><strong>Book Concert Plans/Tickets</strong></li><li><strong>Upload songs and create music events/Concerts</strong></li></ul><p>The bolded points are among the major USPs of this app.</p><p>We all listen to music almost everyday. Imagine, with SOLO you are connecting to the people of your interest while listening to your favorite music. If you are a good singer, it is a platform for you to get the well deserved fame. It’s a music streaming app being a social network at the same time. A social network which does not prompt you to connect to somebody based on the “hot or not basis” but, based on the persona of a person derived from his/her music taste. Having said that, I don’t see a reason not to use this app everyday, enjoying your leisure time with your favorite people as well as your favorite music.</p><p>- Team SOLO</p><blockquote>Do visit our website to know how we make it all possible and see an app demo at: <a href="http://one.solo-design360.tech/">http://one.solo-design360.tech/</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6aeda95bbed1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compare two instances of a complex data structure]]></title>
            <link>https://medium.com/@saurabhgupta_43828/compare-two-instances-of-a-complex-data-structure-667d9c17b48f?source=rss-119fcd0387a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/667d9c17b48f</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[hacks]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Saurabh Gupta]]></dc:creator>
            <pubDate>Mon, 01 May 2017 05:58:04 GMT</pubDate>
            <atom:updated>2017-05-01T05:58:04.901Z</atom:updated>
            <content:encoded><![CDATA[<p>Consider a scenario where you have a complex data structure like a n-dimensional array or maybe a dictionary and you are asked to check whether they are equal or not.</p><p>Well! the most obvious answer is breaking down that data structure into single simple elements and then compare each of them with their corresponding counterparts. <strong>Isn’t it</strong>. Good luck doing that and impressing anyone!</p><p>Let me suggest a technique, comment if you like it…</p><p>We have to keep in mind whatever we are doing we have a constraint on our computation time and resources and hence there’s a need to find an optimal solution.</p><p>Okay, cutting to the chase, <strong>convert those complex data structures into hashes, </strong>and then the problem breaks down to just string matching.</p><p>Now, choice of hash function is also important. I suggest and find <strong>MD5</strong> best for this situation. Using this, it’ll be a <strong>32 length string </strong>you have to compare and you’re good to go.</p><p>Isn’t this interesting?</p><p>Like, share, comment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=667d9c17b48f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>