Commit graph

31 commits

Author SHA1 Message Date
Seth Hall
cb7eac212e Small updates and a little standardization for config.h.in naming. 2012-06-17 22:55:11 -04:00
Vlad Grigorescu
93a7a46af0 Merge branch 'master' of git://git.bro-ids.org/bro into elasticsearch 2012-06-15 10:46:48 -04:00
Jon Siwek
e9c18b51a3 Add more error handling code to logging of enum vals. (addresses #829)
If lookup of enum name by value fails, an error is now sent through
the reporter framework and the value logged will be an empty string
(as opposed to trying to construct a string with null pointer which
throws a logic_error and aborts Bro).
2012-06-08 10:11:54 -05:00
Vlad Grigorescu
7bee0b0d8e Added sending messages to ElasticSearch over HTTP. 2012-06-03 22:07:20 -04:00
Vlad Grigorescu
95f000738b ElasticSearch log writer implementation test 1 - writes out JSON to file instead of sending it over HTTP for now. 2012-06-03 12:40:09 -04:00
Robin Sommer
61ce9b5412 Checkpoint - all src/ except src/input 2012-05-25 14:05:50 -07:00
Jon Siwek
5f3575425d Fix compile errors.
Preprocess out DataSeries.cc based on config.h's USE_DATASERIES value
and one reference to threading::Field needed scoping.
2012-05-17 15:26:28 -05:00
Robin Sommer
7cc863c5fc Fix for when not producing local output; that hung.
* origin/topic/robin/dataseries:
  Moving trace for rotation test into traces directory.
  Fixing a rotation race condition at termination.
  Portability fixes.
  Extending DS docs with some examples.
  Updating doc.
  Fixing pack_scale and time-as-int.
  Adding format specifier to DS spec to print out double as %.6f.
  DataSeries updates and fixes.
  DataSeries tuning.
  Tweaking DataSeries support.
  Extending log post-processor call to include the name of the writer.
  Removing an unnecessary const cast.
  DataSeries TODO list with open issues/questions.
  Starting DataSeries HowTo.
  Additional test output canonification for ds2txt's timestamps.
  In threads, an internal error now immediately aborts.
  DataSeries cleanup.
  Working on DataSeries support.
  Merging in DataSeries support from topic/gilbert/logging.
  Fixing  threads' DoFinish() method.
2012-05-17 12:38:47 -07:00
Robin Sommer
5dae925f67 Fixing a rotation race condition at termination.
Noticed with DS, but could just as well happen with ASCII.
2012-05-16 18:24:55 -07:00
Robin Sommer
a7bc12066b Merge remote-tracking branch 'origin/master' into topic/robin/dataseries
Conflicts:
	CMakeLists.txt
	cmake
2012-04-17 16:37:37 -07:00
Robin Sommer
077089a047 Merge branch 'topic/robin/log-threads'
* topic/robin/log-threads: (42 commits)
  Two more tweaks to reliably terminate when reading from trace.
  This could be fixing the memory problems finally.
  Fix compile errors due to now-explicit IPAddr ctors and global IPFamily enum.
  Switching log buffer size back to normal
  Teaching cmake to always link in tcmalloc if it finds it.
  Extending queue statistics.
  Small fixes and tweaks.
  Don't assert during shutdown.
  Reverting accidental commit.
  Finetuning communication CPU usage.
  Adding new leak tests involving remote logging.
  Removing some no longer needed checks.
  Fixing problem logging remotely when local logging was turned off.
  Preventing busy looping when no threads have been spawned.
  Prevent manager from busy looping.
  Adding missing includes needed on FreeBSD.
  Updating submodule(s).
  Updating submodule(s).
  A number of bugfixes for the recent threading updates.
  Making exchange of addresses between threads thread-safe.
  ...
2012-04-04 17:32:13 -07:00
Robin Sommer
952b6b293a Merging in DataSeries support from topic/gilbert/logging.
I copied the code over manually, no merging, because (1) it needed to
be adapted to the new threading API, and (2) there's more stuff in the
branch that I haven't ported yet.

The DS output generally seems to work, but it has seen no further
testing yet.

Not unit tests yet either.
2012-04-03 22:14:56 -07:00
Robin Sommer
e3f5cbb670 Small fixes and tweaks.
- Fixing tiny leak.

    - Fixing threads stat output.
2012-03-16 09:11:31 -07:00
Robin Sommer
bf14bd91d7 Removing some no longer needed checks. 2012-03-08 17:30:18 -08:00
Robin Sommer
c0678e7e1f Fixing problem logging remotely when local logging was turned off.
For that, moved the remote logging from the Manager to the
WriterFrontend. That also simplifies the Manager a bit.
2012-03-08 17:30:18 -08:00
Robin Sommer
edc9bb14af Making exchange of addresses between threads thread-safe.
As we can't use the IPAddr class (because it's not thread-safe), this
involved a bit manual address manipulation and also shuffling some
things around a bit.

Not fully working yet, the tests for remote logging still fail.
2012-02-28 15:57:43 -08:00
Robin Sommer
4558195dab Merge remote-tracking branch 'origin/topic/bernhard/log-threads' into topic/robin/log-threads
* origin/topic/bernhard/log-threads:
  remove unnecessary error function from manger
2012-02-27 19:07:06 -08:00
Robin Sommer
d24cdd3ba3 Merge remote-tracking branch 'origin/master' into topic/robin/log-threads
Conflicts:
	src/LogMgr.h
	src/RemoteSerializer.cc
	src/logging/Manager.cc
	src/logging/writers/Ascii.cc
	src/net_util.cc
2012-02-27 19:05:47 -08:00
Bernhard Amann
bc6ebe53cc remove unnecessary error function from manger 2012-02-16 11:31:30 -08:00
Robin Sommer
1f8b299aaf Shortening file names a bit. 2012-02-14 10:12:09 -08:00
Robin Sommer
e2794c809f Merge remote-tracking branch 'origin/topic/bernhard/log-threads' into topic/robin/log-threads
* origin/topic/bernhard/log-threads:
  typo
  fix CreateBackend function - the way that the right backend was chosen & backends were initialized did not make sense...
  backend does not need friend access to manager
  move Value and Field from the logging namespace to the threading namespace, because other modules using threading will need them.
  send enum instead of string
  memleak fix.
  make logging framework send the protocol to the writer.
2012-02-14 10:08:46 -08:00
Bernhard Amann
1e4a93c767 Merge remote-tracking branch 'origin/topic/bernhard/log-threads' into topic/bernhard/log-threads 2012-02-13 02:35:10 -08:00
Bernhard Amann
8a6dfee00c Merge remote-tracking branch 'origin/topic/robin/log-threads' into topic/bernhard/log-threads 2012-02-13 02:30:24 -08:00
Robin Sommer
b8ec653ebf Bugfixes.
- Data queued at termination wasn't written out completely.

    - Fixed some race conditions.

    - Fixing IOSource integration.

    - Fixing setting thread names on Linux.

    - Fixing minor leaks.

All tests now pass for me on Linux in debug and non-debug compiles.

Remaining TODOs:

        - Needs leak check.

        - Test on MacOS and FreeBSD.

        - More testing:
            - High volume traffic.
            - Different platforms.
2012-02-12 13:07:26 -08:00
Bernhard Amann
f76bbf01a4 fix CreateBackend function - the way that the right backend was chosen & backends were initialized did not make sense... 2012-02-06 13:15:01 -08:00
Bernhard Amann
115e6a18b4 Merge branch 'topic/bernhard/log-send-proto' into topic/bernhard/log-threads
Send protocol type to log writers - the ascii writer simply ignores this, but the input reader needs support for this.

Conflicts:
	src/LogMgr.h
	src/logging/Manager.cc
2012-02-06 11:08:32 -08:00
Bernhard Amann
a0487ecb30 move Value and Field from the logging namespace to the threading namespace, because other modules using threading will need them. 2012-02-03 14:12:29 -08:00
Robin Sommer
70fe7876a1 Updating thread naming.
Also includes experimental code to adapt the thread name as shown by
top, but it's untested.
2012-02-03 04:04:38 -08:00
Robin Sommer
ffb4094d36 Bugfixes 2012-02-03 04:04:38 -08:00
Robin Sommer
29fc56105d Documenting logging API. 2012-02-03 04:04:37 -08:00
Robin Sommer
e4e770d475 Threaded logging framework.
This is based on Gilbert's code but I ended up refactoring it quite a
bit. That's why I didn't do a direct merge but started with a new
branch and copied things over to adapt. It looks quite a bit different
now as I tried to generalize things a bit more to also support the
Input Framework.

The larger changes code are:

    - Moved all logging code into subdirectory src/logging/. Code
      here is in namespace "logging".

    - Moved all threading code into subdirectory src/threading/. Code
      here is in namespace "threading".

    - Introduced a central thread manager that tracks threads and is
      in charge of termination and (eventually) statistics.

    - Refactored logging independent threading code into base classes
      BasicThread and MsgThread. The former encapsulates all the
      pthread code with simple start/stop methods and provides a
      single Run() method to override.

      The latter is derived from BasicThread and adds bi-directional
      message passing between main and child threads. The hope is that
      the Input Framework can reuse this part quite directly.

    - A log writer is now split into a general WriterFrontend
      (LogEmissary in Gilbert's code) and a type-specific
      WriterBackend. Specific writers are implemented by deriving from
      the latter. (The plugin interface is almost unchanged compared
      to the 2.0 version.).

      Frontend and backend communicate via MsgThread's message
      passing.

    - MsgThread (and thus WriterBackend) has a Heartbeat() method that
      a thread can override to execute code on a regular basis. It's
      triggered roughly once a second by the main thread.

    - Integration into "the rest of Bro". Threads can send messages to
      the reporter and do debugging output; they are hooked into the
      I/O loop for sending messages back; and there's a new debugging
      stream "threading" that logs, well, threading activity.

This all seems to work for the most part, but it's not done yet.

TODO list:

    - Not all tests pass yet. In particular, diffs for the external
      tests seem to indicate some memory problem (no crashes, just an
      occasional weird character).

    - Only tested in --enable-debug mode.

    - Only tested on Linux.

    - Needs leak check.

    - Each log write is currently a single inter-thread message. Bring
      Gilbert's bulk writes back.

    - Code needs further cleanup.

    - Document the class API.

    - Document the internal structure of the logging framework.

    - Check for robustness: live traffic, aborting, signals, etc.

    - Add thread statistics to profile.log (most of the code is there).

    - Customize the OS-visible thread names on platforms that support it.
2012-01-27 17:16:14 -08:00
Renamed from src/LogMgr.cc (Browse further)