Commit graph

240 commits

Author SHA1 Message Date
Pete Fritchman
24169ef165 - refactor agent to be a real daemon
- refactor configs (all inherit from BaseConfig)
- move beef of agent code to lib/net/clients/
- use optionparser's ".order" instead of ".parse"
2009-10-20 17:40:44 +00:00
Jordan Sissel
26082d9309 - Proper daemonizing
- Add --logfile for directing STDOUT and STDERR to a file.
- Require logfile if we are to daemonize
- Set parent process $0 to 'logstash (supervisor)'
2009-10-20 06:59:02 +00:00
Pete Fritchman
c151016413 - support daemonizing
- support a pid file
- set $0 on our indexer & parser children
- handle INT and TERM signals (clean up children)
- switch to waitpid/WNOHANG/sleep(5) loop instead of Process.waitall because
  of a lame bug with ruby 1.8.5 and SIGTERM
2009-10-20 04:55:34 +00:00
Pete Fritchman
c02eb62bcc - remove hacks/testing files that we won't be packaging up 2009-10-20 01:20:58 +00:00
Pete Fritchman
d4459ebf46 - consolidate to one logstashd that forks parsers & indexers
- use logger for output
- stop handling QuitRequests
- re-up broadcast interval to 30 (was @ 5 for debugging)
- add debug output (logstashd -d ...)
2009-10-19 19:03:49 +00:00
Jordan Sissel
405a813f68 - Move search's Directory querying to be synchronous 2009-10-19 10:19:49 +00:00
Jordan Sissel
e1839d359d - Add ability to do synchronous-like messaging:
op = client.sendmsg("logstash-directory", msg) do |response|
    puts response
    :finished
  end

  op.wait_until_finished
  puts "Done!"

  If Socket#sendmsg is given a block, it will return an Operation that is
  useful shown above.
2009-10-19 10:06:39 +00:00
Pete Fritchman
4755c0ae1c - add ability to query what keys are available for a log type
- cache indexreaders, searchers, and queryparsers
2009-10-19 07:09:07 +00:00
Pete Fritchman
6c4c36cdd7 - support querying what log types are available 2009-10-19 06:56:07 +00:00
Pete Fritchman
344e1a4aef - send back [@DATE, @LINE] in search results so we can collate results
from multiple indexers
2009-10-19 06:27:31 +00:00
Pete Fritchman
eeeb7b4cd3 - AMQPize. 2009-10-19 06:23:09 +00:00
Pete Fritchman
e909d241ec - less verbose
- make @close work
- main @id queue cannot be :exclusive (nobody else can write)
- properly make topic exchange auto_delete and exclusive
- refactor search.rb client, start towards a common SearchClient class
  (and work with amqp)
2009-10-19 05:52:18 +00:00
Pete Fritchman
56aac96795 s/stomp/amqp/ 2009-10-19 04:36:06 +00:00
Pete Fritchman
27204e825b - remove some debugging cruft
- remove sample agent.redhat.rb; sample config is the same thing
- indexers now broadcast to each other and build up a directory
- indexers respond to a directory request and provide a list of indexers
- move some errors/usage messages to $stderr
- refactor search.rb to query all available indexers
2009-10-18 23:38:35 +00:00
Jordan Sissel
51a0e8ce8a - Add yaml config for agent
- Ignore dotfiles when considering files of grok patterns
- Fix our monkey patch adding String#strip_upper_ascii. This should probably
  just be in another module and take a string as argument.
- Fix bin/search.rb to point at the right queue (indexer serves searches now)
- Fix websearch to point at correct queue.
2009-10-16 09:57:13 +00:00
Jordan Sissel
25c06132ce - Add logparsed. Runs N processes with a parser for each process. 2009-09-21 06:43:33 +00:00
Jordan Sissel
82e5bf79e9 - Don't hack an exception onto String#scan (only needed it for debugging anyway) 2009-09-19 10:06:31 +00:00
Jordan Sissel
4b870cc9fd - add haproxy bits 2009-09-11 10:54:57 +00:00
Jordan Sissel
e9c314dee6 - Move from config.rb to config.yaml
- logstashd now takes a config.yaml as the only argument.
2009-09-11 10:24:13 +00:00
Greg Retkowski
9df61fc0c1 Updated installation/running instructions. Created an agent with sane
defaults for redhat-based systems.
2009-09-10 21:24:20 +00:00
Jordan Sissel
434a633013 - hashbind is back! Dynamically generate methods that we would normally
hand-code. This method is as fast as the hand-coded method and with less
  writing.
- Make message registration easier with a simple 'register' function:
  class Foo < Message
    register
  end

  We dynamically generate the message 'type' by the class name.
2009-09-10 09:59:24 +00:00
Jordan Sissel
07ade32cc9 - Add 'SearchHits' request to get the count of results (but not the results)
for a given search query.
- Allow a client to close in a message handler, but only handle the actual
  close until after we have ack'd the message.
2009-09-08 09:51:35 +00:00
Jordan Sissel
d6cf0f34fb - ruby-prof showed that hashbind was taking the most time, so convert away from it.
- make it easy to try using ruby  marshal instead of json for wire format, for comparing speed.
- Set Thread::abort_on_exception so when threads die due to simple syntax or
  name errors they don't die silently.
- Add basic search client
2009-09-08 06:05:09 +00:00
Jordan Sissel
f55513ba12 * In client ack mode, StompServer will only send one message at a time, waiting
for an ack for that message before sending another. Work around this:
  - batch up messages to sendmsg() and flush when there are more than 10 in the
    queue or there has been more than 1 second since flushing and the queue is
    non-empty

This increases the indexing rate by a factor of 6.
2009-09-06 23:38:04 +00:00
Jordan Sissel
1e33e3af19 - Got things happy using STOMP 2009-09-06 22:13:06 +00:00
Jordan Sissel
22b8c6eaca - don't flush stdout 2009-08-19 00:17:10 +00:00
Jordan Sissel
46c4feb300 - Support ruby 1.9 2009-08-18 19:47:05 +00:00
Jordan Sissel
42df5ba36b - Support yielding to blocks for client and server #run methods
- Start hacking on having client writes block if we are far behind on getting
  message acks (w/ exponential backoff).
2009-08-18 09:45:02 +00:00
Jordan Sissel
173840a827 - Refactor network code to use EventMachine
Message decoding is working, but I think we're silently dropping data somewhere.
2009-08-18 09:01:39 +00:00
Jordan Sissel
96e4881de2 - Fix Log#index_dir
- SYNCDELAY for indexing to 10 seconds, for debugging/testing.
- Batch search results to 10 per message block
2009-08-17 08:47:05 +00:00
Jordan Sissel
14d65e1522 - s/LOGSTASH_HOME/LOGSTASH_DIR/
- Fix variable references 
- Add 'finished' field to SearchResponse to indicate the end of 
  search results.
2009-08-17 08:24:54 +00:00
Pete Fritchman
ad7c9b3f24 - remove old indexer prototype; the sandbox server is working now
- move sandbox server to bin/logstashd.rb
2009-08-17 02:55:14 +00:00
Jordan Sissel
6cdb98559a - Add LogStash::Net::MessageClientConnectionReset
- Add LogStash::Net::NoSocket
- Add special 'signal' socketpair that is always used in select() as a reader
  so that we can, from sendmsg(), notify select() that we should end and loop
  again
- MessageSocketMux#connect now returns true if the connection succeeded. An
  exception is thrown otherwise.
- Only include writers who have populated output streams.
- If we had a client receiver (via #connect(..)) before, but it went away,
  assume the connection was destroyed/reset by some other means and that this is
  an error to be handled by the client.
- Don't immediately add a socket to the @writers list when it's created.
- If _sendmsg has a socket that is nil, raise NoSocket. If _sendmsg is called
  with a nil socket, and @receiver (created through #connect(...)) is also nil,
  this is an error and we throw NoSocket.
- Delete @receiver if it is a socket that is being removed.
- Delete socket from @writers once we flush it's data out the socket.
- Raise MessageClientConnectionReset on EOF/IOError or ECONNRESET
- indexer: Sync index every 60 seconds
- Add alpha version of Agent. It watches /var/log/messages.

Tested:
  - Both the agent and indexer server are capable of recovering from disconnections.
  - searcher test code (sandbox/searchclient.rb) works while Agent is feeding
    the indexer
2009-08-14 09:05:44 +00:00
Pete Fritchman
68183f9c6a - revive test_parse_entry
- LOGSTASH_HOME
- don't display @LINE
2009-08-10 02:12:13 +00:00
Pete Fritchman
3d9cf8e58f - add profiling (temporary, but very useful for now) 2009-08-07 00:52:17 +00:00
Jordan Sissel
127394a84b - Use RubyGrok instead of IO.popen("grok ...")
Requires installed: http://semicomplete.googlecode.com/svn/cgrok/ruby/
- use $HOME for logstash index directory.
- Have import use Time.now.to_f to get higher-precision time values.
2009-08-06 08:39:05 +00:00
Pete Fritchman
002c080abb - display import rate 2009-08-06 05:38:20 +00:00
Pete Fritchman
944939a7ee - search by @DATE, by default 2009-08-06 05:37:59 +00:00
Pete Fritchman
94944089d9 - actually create an index from the default FieldInfos. now that we're
using these defaults, importing is faster and there is a much better
  log:index size ratio.
2009-08-06 05:37:23 +00:00
Pete Fritchman
82fdc11f2e - early early early-stage logstash prototype 2009-08-05 01:01:23 +00:00