<?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[synapseinc - Medium]]></title>
        <description><![CDATA[Re-imagining smartphone utilities through the lens of AI - Medium]]></description>
        <link>https://medium.com/synapseinc?source=rss----d5745205f299---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>synapseinc - Medium</title>
            <link>https://medium.com/synapseinc?source=rss----d5745205f299---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 14:05:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/synapseinc" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Managing logs with Logrotate]]></title>
            <link>https://medium.com/synapseinc/managing-logs-with-logrotate-8cb530e54e05?source=rss----d5745205f299---4</link>
            <guid isPermaLink="false">https://medium.com/p/8cb530e54e05</guid>
            <category><![CDATA[logstash]]></category>
            <category><![CDATA[logs]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Devang Paliwal]]></dc:creator>
            <pubDate>Tue, 21 Mar 2017 15:07:20 GMT</pubDate>
            <atom:updated>2017-03-21T15:07:19.640Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern applications generate lots of data in form of debug and error logs. Logs are necessary because they allow us to find and debug bugs in production. If not maintained, we may end up with log files of size greater than few GB’s. Large log files creates following issues -</p><ul><li><em>Hard to debug</em></li><li><em>Takes lot of server space</em></li><li><em>Superfluous logs remain on the server for long time</em></li><li><em>Identifying logs of particular day becomes arduous</em></li></ul><p>It becomes arduous to debug issues in such cases. So what do we do? How do we make sure that we have <strong>small log files?</strong> How do we take <strong>backup</strong> of logs? How do we <strong>compress</strong> them? How do we <strong>remove</strong> them after certain period of time?</p><blockquote>Logrotate unix utility is the solution for all above mentioned issues.</blockquote><p>Solution &amp; options<br>Logrotate is a unix utility which allows users do following things -</p><ul><li>Rotate a file when its size reaches a certain limit</li><li>Compress the log files using user specified compression algorithm</li><li>Run a script after the Log rotation</li><li>Add date in the rotated file name</li><li>Remove older log files</li></ul><p>Here a sample config -</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bcd13a4fb4bc6bd1899ce1bd1e136fff/href">https://medium.com/media/bcd13a4fb4bc6bd1899ce1bd1e136fff/href</a></iframe><p>This configuration applies to a file placed at <strong>/foo/bar/poll.log</strong> location. Lets look at the config one by one.</p><p><strong>size 1000k</strong> — tells the utility to create a separate file the moment poll.log reaches 1000k size<br><strong>create</strong> — this creates a file with 700 permission with user root and group webapps<br><strong>dateext </strong>— appends the filename with today’s date<br><strong>rotate 4</strong> — Keeps only last 4 rotated files<br><strong>compress</strong> — It compresses the rotated file</p><p>Above mentioned configuration has to be done in <strong>/etc/logrotate.conf</strong></p><p>For more information on Logrotate utility <a href="https://linux.die.net/man/8/logrotate">visit</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cb530e54e05" width="1" height="1" alt=""><hr><p><a href="https://medium.com/synapseinc/managing-logs-with-logrotate-8cb530e54e05">Managing logs with Logrotate</a> was originally published in <a href="https://medium.com/synapseinc">synapseinc</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tricks to restore large mongo collections on small machine]]></title>
            <link>https://medium.com/synapseinc/tricks-to-restore-large-mongo-collections-on-small-machine-bc5c27c9076b?source=rss----d5745205f299---4</link>
            <guid isPermaLink="false">https://medium.com/p/bc5c27c9076b</guid>
            <category><![CDATA[memories]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Devang Paliwal]]></dc:creator>
            <pubDate>Tue, 06 Dec 2016 17:06:04 GMT</pubDate>
            <atom:updated>2016-12-06T17:51:28.403Z</atom:updated>
            <content:encoded><![CDATA[<p>Mongo is an open source no-sql database which stores data in documents and collections. We use mongodb at <strong>Synapse</strong> because its developer friendly and allows us to churn out api’s in no time. It also plays well with Django and we can code up features without worrying about schema and migrations.</p><p>Taking backups and restoring them to work with latest data is part of daily life at Synapse. Mongo provides mongodump and mongorestore command line utilities to make that easy for the developers.</p><h3><strong>Mongorestore</strong></h3><p>mongorestore is a command line utility by which one can restore some or all the collections. mongorestore loads a collection or database in memory and then puts it in database. It also creates the indexes for the restored collection afterwards. You might say what’s the problem with this?</p><h3><strong>Problem</strong></h3><blockquote>Sometimes when the size of collection is too large it may result in <strong>insertion error:EOF</strong> or <strong>unexpected input:EOF</strong> exceptions causing mongo-db instance to crash.</blockquote><p>The error is not suggestive but it’s related to available RAM on the machine. Mind you — its the RAM which matters instead of hard drive space. So how did we solved this?</p><h3><strong>Solution</strong></h3><p>There are two possible solutions to this problem -</p><blockquote>To restore the collections one by one.</blockquote><blockquote>To create/update the swap space on the machine.</blockquote><p>We tried the first approach and were successful till we encountered a 1.3 GB collection. We were working on a small machine with 512 MB RAM and Ubuntu 16.04.</p><p>We tried the next approach of <strong>creating the swap space of 2 GB</strong> and we were able to restore the database. Here are the steps to create the swap space -</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45ca6d7c771747cd16ec6e5ef12a921c/href">https://medium.com/media/45ca6d7c771747cd16ec6e5ef12a921c/href</a></iframe><p>Read this <a href="https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04">article</a> for more information on setting up permanent swap space on Ubuntu 14.04.</p><h3><strong>Conclusion</strong></h3><p>Mongo allows us to backup and restore databases and collections. If you happen to face <strong>insertion error:EOF</strong> it can be a memory related issue and trying out one of the above listed solution can get you out of trouble.</p><blockquote>But remember that creating swap space can slow down the things because reading from file is way slower than reading from RAM. Swap is a short term solution and one should upgrade the RAM to a larger one to avoid such issues in future.</blockquote><p>Mongo is working out quite well for us. We are able to roll out new features without worrying too much about schema and migrations. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc5c27c9076b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/synapseinc/tricks-to-restore-large-mongo-collections-on-small-machine-bc5c27c9076b">Tricks to restore large mongo collections on small machine</a> was originally published in <a href="https://medium.com/synapseinc">synapseinc</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mongo db backup script]]></title>
            <link>https://medium.com/synapseinc/mongo-db-backup-script-1af12d30564a?source=rss----d5745205f299---4</link>
            <guid isPermaLink="false">https://medium.com/p/1af12d30564a</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[backup]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Devang Paliwal]]></dc:creator>
            <pubDate>Wed, 09 Nov 2016 11:32:08 GMT</pubDate>
            <atom:updated>2016-11-09T11:32:08.355Z</atom:updated>
            <content:encoded><![CDATA[<p>Data safety is the most important priority for any company and its no-brainer to take db backups regularly. It ensures that in case of emergency like compromised server, availability zone failure etc, the data is safe and can be restored quickly to get the system up and running.</p><p>Here’s a snippet of shell script which we use at Synapse Inc for daily database backup. It accomplishes three key things for us -</p><ul><li>Creates a backup directory to store DB dumps</li><li>Takes DB dump</li><li>Compress the db dump and move it to backup directory</li></ul><p>Here’s the script -</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/43a77bee06858926708c3379835bff40/href">https://medium.com/media/43a77bee06858926708c3379835bff40/href</a></iframe><p>Add this script to the cron table using <a href="http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples"><strong>crontab -e</strong></a> command. For example: to take backups every 12 hours you can use following command -</p><p>0 */12 * * * /bin/bash &lt;path to script&gt;</p><p>Enjoy peaceful backups.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1af12d30564a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/synapseinc/mongo-db-backup-script-1af12d30564a">Mongo db backup script</a> was originally published in <a href="https://medium.com/synapseinc">synapseinc</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>