Friday, May 20, 2016

Workaround for creating chart from messages with non-numeric fields in Graylog

As we all know, Graylog doesn't support creating a chart on non-numeric value at the moment. There is a neat workaround suggested by Drew Miranda that can fulfil this functionality. I'll try to rephrase it step by step.

  1. Go to Graylog UI page
  2. Make a search for the field and value that you want to represent as a chart
  3. Around the bottom left corner of search page, click all fields
  4. Find timestamp field and generate chart from it
  5. Around top right of the chart, Customize > Value > Total
That's it for a single value chart. But if you want a chart to contain multiple values, keeps going
  1. Redo 2-5 again for different fields
  2. Click and hold on hamburger menu button at the top right of each, drag to merge them
That's neat right?

Thursday, May 19, 2016

Add local registry mirror to docker daemon on systemd ubuntu (after 15.04)

After docker installation, follow this steps

  • Create directory /etc/systemd/system/docker.service.d if not exist
  • Create mirror.conf file inside that directory. The name "mirror" can be changed to anything.
  • In the file, add this lines
ExecStart=/usr/bin/docker daemon -H fd:// --registry-mirror=http://registry-host:registry-port
  • registry-host is hostname/ip of your local registry mirror
  • registry-port is port of your local registry mirror
  • Flush the change with $ sudo systemctl daemon-reload
  • Restart docker with $ sudo systemctl restart docker
  • Check if the change is successfully applied with $ systemctl status docker,  your config should appear somewhere in the command output.
Tested on Docker 1.11, Ubuntu 15.10 & 16.04

If you want more explanations about these commands, please refer to follow links. Thank you for all of them for providing me a direction to solve the issue and also come up with this post.

Thursday, May 12, 2016

Delete unused (orphaned) Docker volume

Since Docker 1.9, there's an easy way to find unused volumes and delete them.

To list unused volumes, use this command

$ docker volume ls -qf dangling=true

To delete them, use

$ docker volume rm $(docker volume ls -qf dangling=true)

Credit: I copied the whole thing from this SO answer

Tuesday, May 10, 2016

[Fixed] WARN Not all child routes satisfy compojure.api.routing/Routing. {:path nil, :method nil}, invalid child routes:

I had this error in my client app that uses compojure-api. The cause of this problem is that I put the static assets routing configuration in the wrong place. We put (route/resources "/") inside defapi which is a place for api routing configurations. So to fix this, we create a defroutes for static assets routing config and merge this defroutes with defapi before giving it to webserver as a ring handler. At the end, the code look something like this.

(ns my.namespace
  (:require [compojure.api.sweet :refer [defapi]]
            [compojure.core :refer [defroutes routes]]
            [compojure.route :as route]))

(defapi app

(defroutes site
  (route/resources "/"))

(defn handler []
  (route site app))

Clojure how to get JVM options from inside application

(.getInputArguments ( Credit:  How to get vm arguments from inside of java applic...