I wrote previously about using fluentd to collect logs as a quick solution until the “real” solution happened. Well, like many “temporary” solutions, it settled in and took root. I was happy with it, but got progressively more bored of coming up with elaborate command pipelines to parse the logs.
Fluentsee
So in the best DevOps tradition, rather than solve the initial strategic problem, I came up with an another layer of paint to slap on as a tactical fix, and fluentsee was born. Fluentsee is written in Java, and lets you filter the logs, and print out different format outputs:
$ java -jar fluentsee-1.0.jar --help
Option (* = required) Description
--------------------- -----------
--help Get command line help.
* --log <String: filename> Log file to use.
--match <String: field=regex> Define a match for filtering output. May pass in
multiple matches.
--tail Tail the log.
--verbose Print verbose format entries.
So, for example, to see all the log entries from the nginx container, with a POST you would:
$ java -jar fluentsee-1.0.jar --log /fluentd/data.log \ --match 'json.container_name=.*nginx.*' --match 'json.log=.*POST.*'
The matching uses Java regex’s. The parsing isn’t wildly efficient but keeps up generally.
Grab it on Github
There’s a functional version now on github, and you can expect enhancements, as I continue to ignore the original problem and focus on the tactical patch.