Skip to content

Instantly share code, notes, and snippets.

{
"_links" : {
"paymentEntityDetails" : {
"href" : "/api/v6/paymentEntities/123456"
}
}
}
@nrdsrfr
nrdsrfr / tail.md
Last active August 29, 2015 14:01
Tailing Log Files

When debugging, it's nice to be able to easily see only what you want from your application log in real time. For *nix guys this is the norm, but Windows people have been crippled by the cmd.exe shell for ages and don't realise how easy it is. Luckily if you use Git for source control you will have Git Bash and/or Git Shell installed, which have some useful commands you can use.

The first is tail, which prints the last n lines of an input you give it (10 lines by default). You can use the -f option to "follow" the input, meaning it will give you nice scrolling text as the file updates assuming you tail a file as input.

Next up is grep which finds text patterns from an input and prints each line that matches. You can use simple text search grep search or regex with the -E option grep -E 'regex'.

Finally, you should be aware of "pipes" |, which allow you to pass output from one command into the input of another.

So, to put all this together, let's say you want to watch a log file fo

@nrdsrfr
nrdsrfr / Zuul-SPINE.groovy
Created April 2, 2014 09:25
Hacky Zuul filter which validates the request endpoint, sets host depending on API version and shows how to override static HttpServletRequest paths using an HttpServletRequestWrapper (routing really should be done in separate route filter)
package scripts.preProcess
import com.netflix.zuul.ZuulFilter
import com.netflix.zuul.context.Debug
import com.netflix.zuul.context.RequestContext
import org.apache.commons.lang.StringUtils
import org.apache.http.MethodNotSupportedException
import org.codehaus.groovy.util.StringUtil
import javax.servlet.http.HttpServletRequest