Sequelize: IS NULL / IS NOT NULL

Sequelize has a neat / bizarre syntax for making parts of WHERE clauses into JSON objects. For “IS NULL”, try this: db.Alert.find( {where: { UserId: req.params.user_id, url: { $ne: null } }}) .then( (alert) => { // handle result } ); This renders the following SQL (formatted for readability): SELECT "id", "title", "text", "domain", "lastRun", […]

Sequelize Update example

There are a couple ways to update values in the Sequelize ORM: db.Alert.update( { url: url }, { fields: [’url’], where: {id: id} } ); If you have an object, this is also supposed to work: var alert = db.Alert.find( {where: { id: id, UserId: }});   alert.update({ url: ‘’ }).then(function() {})

Monitoring a WordPress site with Filebeat

In a previous post, I discuss setting up the ELK stack on Azure, which is a prerequisite for using Logbat. To pump logs from a linux server to , we can use a tool called Filebeat (not sure where that fits in “ELK”?) On the server you want monitored, you’ll need to download the appropriate […]


Installing the ELK stack on Azure

The “ELK stack” is an open source product offering used for indexing and searching server logs. This combines three open source tools (Elastic Search, LogStash, Kibana), which seem to be maintained by the company behind Elastic Search. Elastic Search is the most well known, and handles full text indexing. Logstash handles the ETL process that […]

Logstash: fixing “Unable to fetch mapping. Do you have indices matching the pattern”

If you set up ELK (elastic search, logstash, kibana) using a guide, you may get the following error: “Unable to fetch mapping. Do you have indices matching the pattern” This indicates that Kibana can’t find log data in elastic search. When the logstash service starts correctly, it creates this database (one per day, apparently). Apparently […]

Logstash: fixing permission denied errors

If you set up logstash to monitor /var/log, you may get errors like this: {:timestamp=>”2015-12-21T17:21:42.809000+0000″, :message=>”failed to open /var/log/auth.log: Permission denied – /var/log/auth.log”, :level=>:warn} {:timestamp=>”2015-12-21T17:21:42.828000+0000″, :message=>”failed to open /var/log/kern.log: Permission denied – /var/log/kern.log”, :level=>:warn} Fortunately this is easy to fix – by default logstash creates it’s own user and group, and you can add it’s […]

, ,

Generate summaries for your WordPress blog posts using Python

Using the WordPress Rest API plugin you can easily get a JSON payload containing data from your blog. If you use SSL, you likely will need to use Python 3, as this includes many bug fixes. First, load the page text: url = ‘′   import urllib3 http = urllib3.PoolManager(10) response = http.request(’GET’, url) Then […]

Fixing SSL23_GET_SERVER_HELLO:tlsv1in python

I found that using urllib/urllib2/urllib3 to pull urls from my site & Anaconda Python, I get SSL errors: SSL23_GET_SERVER_HELLO:tlsv1 There are a lot of suggestions here: However going through these suggestions, only upgrading to Python3 Anaconda fixed this for me.

Script to get values from wikiart pages

The following script will pull data values from a wikiart page (an excellent index of paintings) – import glob   indir = ‘D:\\projects\\art\\’ for filename in glob.glob(indir + "*.html"): print filename spans ="span[itemprop]") ahrefs ="a[itemprop]")   file = open(filename, ‘r’)   soup = BeautifulSoup(file, ‘html.parser’)   spans ="span[itemprop]") arefs ="a[itemprop]")   […]