Last active
August 29, 2015 13:57
-
-
Save iantruslove/9478996 to your computer and use it in GitHub Desktop.
Convert one of @Raynes' #clojure log files to a multiline JSON file ready for ElasticSearch's _bulk import API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s http://www.raynes.me/logs/irc.freenode.net/clojure/2011-07-04.txt \ | |
| sed -r 's/\\/\\\\/g' | sed -r 's/"/\\"/g' \ | |
| sed -r 's/^\[([^\]+)\] ([^:]+): (.*)$/{ "index" : { "_index" : "irc.freenode.clojure", "_type" : "message" } }\n{ "datestamp": "2011-07-04T\1", "author": "\2", "message": "\3" }/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment