Skip to main content


Showing posts from 2015

Logstash: Looping through nested JSON in ruby filter

Suppose we have a JSON payload (may be a stream coming from Kafka) that looks like this:
{"regionName":"asia","nodes":[{"node":"","weight":"0"},{"node":"","weight":"100"}]} {"regionName":"asia","nodes":[{"node":"","weight":"0"},{"node":"","weight":"0"},{"node":"","weight":"100"},{"node":"","weight":"100"}]} To loop through the nested fields and generate extra fields from the calculations while using Logstash, we can do something like this:
input { kafka { bootstrap_servers => "kafka.singhaiuklimi…

Add Environment variables and aliases to Bash on Mac OSX


Add following in ~/.profile (or ~/.bash_profile, or ~/.bashrc, or /etc/profile if you have access):
export JAVA_VERSION=1.8 export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home export PATH=$PATH:$JAVA_HOME/bin alias ll='ls -al' # This alias recursively destroys all .DS_Store files in the folder I am currently in alias killDS='find . -name *.DS_Store -type f -delete' # This alias reloads this file alias reload_profile='. ~/.profile' # Mac get stuck very often and are extremely slow and unstable on shutdowns. This forces a shutdown. alias poweroff='sudo /sbin/shutdown -h now' # To ignore space changes while doing git diff alias gitdf='git diff --ignore-space-change' # Show Git branch in prompt parse_git_branch() { git branch 2…