Elktail - Command Line Tool for Tailing and Querying ELK Logs

I've started using ELK stack (Elasticsearch, Logstash, Kibana) as a default go-to option whenever I require a log management solution in a project that I work on. Analysing and searching through the logs is much nicer when done through Kibana's web UI then grepping through the log files as you would do if you had no log management. However, from time to time, there still comes a moment where I wish I could just tail -f the log file to see what's happening right now in this moment. After googling around and not finding what I wanted, I ended up building Elktail, a command line utility that allows you to search and tail your logs stored in Elasticsearch.

Read More →

Streaming MySQL Results Using Java 8 Streams and Spring Data JPA

Since version 1.8, Spring data project includes an interesting feature - through a simple API call developer can request database query results to be returned as Java 8 stream. Where technically possible and supported by underlying database technology, results are being streamed one by one and are available for processing using stream operations. This technique can be particularly useful when processing large datasets (for example, exporting larger amounts of database data in a specific format) because, among other things, it can limit memory consumption in the processing layer of the application. In this article I will discuss some of the benefits (and gotchas!) when Spring Data streaming is used with MySQL database.

Read More →

Manage Spring Boot Logs with Elasticsearch, Logstash and Kibana

When time comes to deploy a new project, one often overlooked aspect is log management. ELK stack (Elasticsearch, Logstash, Kibana) is, among other things, a powerful and freely available log management solution. In this article I will show you how to install and setup ELK and use it with default log format of a Spring Boot application.

Read More →

Manually Installing E2guardian to pfSense

DansGuardian package that provides web filtering capabilities seems not to work on the latest pfSense firewall distribution. Thanks to the effort of the open source community, and specifically Marcello Coutinho, e2guardian package (a fork of DansGuardian) made it to FreeBSD repos, and Marcello created a package for pfSense. While pfSense team is working to integrate the package into the official distribution to make it available through standard package management system, many people (including myself) would like to have e2guardian running right now and install it manually. Here are the step by step instruction for the manual installation process that I used to install it to my pfSense (with help from Marcello, Phil and other folks from pfSense forums).

Read More →

Counting Queries per Request with Hibernate and Spring

Hibernate is a powerful ORM tool, no doubt about it. In projects using Hibernate, it can sometimes become easy to forget that underneath it there are actual SQL queries being executed, sometimes many of them, and sometimes, well, too many. As you navigate the object graphs of your entities and admire collections being populated automagically, beware that if Hibernate's query generation is left unchecked, you can easily end up executing gazzilions of unnecessary SQL queries unknowingly (I've actually seen thousands(!!) of queries executed per page render). Fortunately, these situations can usually be easily avoided once they are detected. I'm going to present one idea how to keep query generation in check.

Read More →

I Discovered JBake

When I was starting this blog and was researching what options are out there in terms of blogging systems, I was looking for a simple developer focused blogging solution that I could use for publishing posts hosted on github pages. I found Octopress and decided to use it, mostly because it popped up often in Google search results and had a tag line that I liked: A blogging framework designed for hackers. And it was fine.

Recently though, I stumbled upon JBake. I liked it so much that I'm switching my blog away from Octopress.

Read More →

Part 1: The Value of @Value

Did it ever happen to you that after spending some time and gaining experience with a framework or a programming language, you learn things that would have made your programmer's life much easier if you had known them right from the start? You would have done things differently, more quickly, in a simpler, cleaner and more maintainable way?

I decided to write a series of posts about features and aspects of Spring Framework (the framework in which I spend most of my professional software development time) that I found useful (usually far later than I'd like to admit :) ), but which are often not covered in entry level guides and tutorials.

In this first post I would like to discuss the @Value annotation.

Read More →

Concise Integration Tests that Contain Mocks in Spring Framework

In this post I'll write about how to reduce a bit of boilerplate code when writing tests in Spring Framework in a situation where we don't want to bring up the whole Spring context in order to test if only a subset of components are working together correctly.

Our goal will be to have Spring load only the components that we are interested in testing, mock out everything else and do it in a simple and readable way.

Read More →

Older posts are available in the archive. Site baked with JBake.