logstash is written in JRuby but I release standalone jar files for easy deployment, so you don't need to download JRuby or most any other dependencies. I bake as much as possible into the single release file.
java -jar logstash-1.0.17-monolithic.jar agent -f hello.conf
Type stuff on standard input. Press enter. Watch what event logstash sees. Press ^C to kill it.
java -jar logstash-1.0.17-monolithic.jar agent -f hello-search.conf
Same config as step 2, but now we are also writing events to ElasticSearch. Do a search for '*' (all):
curl http://localhost:9200/_search?pretty=1&q=*
The previous step is good, but a better frontend on elasticsearch would help!
The same config as step 3 is used.
java -jar logstash-1.0.17-monolithic.jar agent -f hello-search.conf -- web --backend 'elasticsearch:///?local'
The above runs both the agent and the logstash web interface in the same process. Useful for simple deploys.
Go to the logstash web interface in browser: http://localhost:9292/
Type stuff on stdin on the agent, then search for it in the web interface.
Let's backfill some old apache logs. First, let's use grok.
Requirements:
Use the 'grok' logstash filter to parse logs. Once you have libgrok installed, keep reading below.
java -jar logstash-1.0.17-monolithic.jar agent -f apache-parse.conf
Logstash will now be listening on TCP port 3333. Send an apache log message at it:
nc localhost 3333 < apache_log.1
The expected output can be viewed here: step-5-output.txt
Same as the previous step, but we'll output to ElasticSearch now.
java -jar logstash-1.0.17-monolithic.jar agent -f apache-elasticsearch.conf -- web --backend 'elasticsearch:///?local'
Logstash should be all set for you now. Start feeding it logs:
bzip2 -d apache_log.2.bz2
nc localhost 3333 < apache_log.2
Go to the logstash web interface in browser: http://localhost:9292/
Try some search queries. Click on some results.
For further learning, try these: