Skip to content

Instantly share code, notes, and snippets.

@iantruslove
Last active August 29, 2015 13:57
Show Gist options
  • Save iantruslove/9478996 to your computer and use it in GitHub Desktop.
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
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