This article presents a simple Logtilla log analysis module, log_geoip_stats, which gives the top N client countries, in terms of hits, from web access log files. This module uses the libgeoip-erlang library to get geolocations from clients' IP addresses.
I have recently released Logtilla, a framework for parsing and analysing web access log files, and showed in a previous article how to use Logtilla with a simple example. One of the most interesting aspects of Logtilla is in the inside. Logtilla demonstrates how to use ASN.1 to communicate between an Erlang program and a C port program. This article is both an introduction to the usual concepts of ASN.1, and a tutorial to apply ASN.1 to integrate Erlang and C programs. The protocol defined in Logtilla is simple, but the approach described can be used to implement sophisticated distributed protocols, especially appropriate for systems management applications.
I have written a small Erlang framework for parsing web access logs, called Logtilla, hosted on GitHub. This framework supports parsing logs in the Common Log Format, or in Apache's Combined Log Format. Thanks to the use of a C port program to do the parsing, Logtilla is very efficient: it can parse and analyze 15,000 entries/sec on my 4-year-old laptop.
I have sent patches to GNU Autoconf to add new macros for testing Erlang modules, include files, and functions: AC_ERLANG_CHECK_MOD, AC_ERLANG_CHECK_HEADER, AC_ERLANG_CHECK_LIB_HEADER, and AC_ERLANG_CHECK_FUNC. I have also sent a patch to fix the AC_RUN_IFELSE macro which executes Erlang test code, so that this macro cleanly fails if the code doesn't compile, and another patch to fix the AC_COMPILE_IFELSE macro, which tests that Erlang test code compiles (this is a long known Autoconf bug).
GNU Autotest is GNU Autoconf's unit testing tool. and is very generic, portable and simple. Autotest is therefore well suited to run tests using other testing tools, such as EUnit (Erlang/OTP's unit testing tool), JUnit, etc. I just added to GNU Autoconf the AT_CHECK_EUNIT macro to run EUnit unit tests in Autotest testsuites. It is the first Autotest macro to integrate such an external testing tool, and will be included in the next version of GNU Autoconf (> 2.64). A complete, working example project using AT_CHECK_EUNIT can be downloaded in autotest-eunit-demo-1.0.tgz. This article shows how to use AT_CHECK_EUNIT by explaining the important parts of this example project.
I have restarted actively maintaining the Erlang support in GNU Autoconf. Autoconf version 2.64 has been released on July 26th, which contains a few changes to its Erlang support.
A user of the GNU Autotools (Autoconf and Automake) with Erlang/OTP has recently asked me about a way to automatically generate the .app (application resource) files and .rel (release resource) files for an Erlang/OTP application. This is a perfect occasion to present the ideas that Ruslan Babayev had on the subject, which I promised to publish back in Sep. 2006. I am "only" 18 months late! (^_^);
I have published a new version of Dryverl, version 0.1.3. This is a minor release, that corrects two bugs.
Dryverl supports <dev-c-local-variable/> elements to declare local variables in the generated C code. The first bug was that Dryverl allows such an element to be empty, which would mean that the generated C local variable declaration has no specific initial value. However, in that case, Dryverl generated invalid declarations, such as:
int some_var = ();
Dryverl 0.1.3 now correctly generates no initializer in such cases: