Commit graph

24 commits

Author SHA1 Message Date
Jon Crussell
cb6f6467c7 Fixed Segmentation fault in SQLite Writer.
Segmentation fault caused by accessing fields with pos which is
one-based for setting SQLite field values. Fix is to simply subtract one
from pos. Discovered when trying to store HTTP traffic to a SQLite
database with the following Bro script:

event bro_init() {
  local filter: Log::Filter = [
    $name = "sqlite",
    $path = "http",
    $config = table(["tablename"] = "http_logs"),
    $writer = Log::WRITER_SQLITE
  ];

  Log::add_filter(HTTP::LOG, filter);
}
2013-11-10 22:02:24 -08:00
Bernhard Amann
363cfb8506 rename the dbname configuration option to tablename.
Sorry for this - I noticed that I named this option quite unfortunately
while writing the documentation.

The patch also removes the dbname configuration option from the sqlite
input reader - it was not used there at all anymore (and I did not notice
that).
2013-10-17 12:24:40 -07:00
Robin Sommer
d127d8d01d Merge remote-tracking branch 'origin/topic/jsiwek/coverity'
* origin/topic/jsiwek/coverity:
  Fix uninitialized (or unused) fields.
  Remove logically dead code.
  Remove dead/unfinished code in unary not expr.
  Fix logic for failed DNS TXT lookups.
  A couple null ptr checks.
  Improve return value checking and error handling.
  Remove unused variable assignments, dead code.
  Prevent division/modulo by zero in scripts.
  Fix unintentional always-false condition.
  Fix invalidated iterator usage.
  Fix DNS_Mgr iterator mismatch.
  Set safe umask when creating script profiler tmp files.
  Fix nesting/indent level whitespace mismatch.
  Add checks to avoid improper negative values use.

BIT-1085 #merged
2013-10-02 11:05:49 -07:00
Jon Siwek
775ec6795e Fix uninitialized (or unused) fields. 2013-09-27 10:13:52 -05:00
Robin Sommer
b11a397168 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  change sqlite3 default threading mode to no-mutex, disable memory statistics, finalize prepared statement before exitting logger.
2013-05-17 13:50:59 -07:00
Bernhard Amann
bd02da8a0c change sqlite3 default threading mode to no-mutex, disable memory
statistics, finalize prepared statement before exitting logger.

This might fix the deadlock issue, at least it did not happen for
me on my tried on the test system where it happened quite regularly
before.
2013-05-17 13:38:26 -07:00
Robin Sommer
de88645d05 Merge remote-tracking branch 'origin/topic/bernhard/sqlite'
* origin/topic/bernhard/sqlite:
  fix a few small rough edges (mostly comments that do no longer apply)
  fix bug in input-manager regarding enums that a writer reads without 0-terminating the string
  actually make sqlite work again (tests passed because the writer was not actually defined because of the define.)
  add sqlite distribution.
  fix warnings, update baselines, handle rotation
  add sqlite tests and fix small vector/set escaping bugs
  fix small bug with vectors and sets.
  make work with newer AsciiFormatter.
  start adding a different text for empty records for the sqlite writer.
  no, you will never guess from where I copied this file...
  make sqlite support more or less work for logging and input
  make sqlite-writer more stable.
  make it compile with new version of AsciiInputOutput
  and adapt to AsciiInputOutput - seems to work...
  make it compile
  add SQLite reader.
  ...adapt to new api...
  now the writer supports tables and vectors.
  basic sqlite writer seems to work.
2013-05-14 17:11:09 -07:00
Bernhard Amann
6036872faa fix a few small rough edges (mostly comments that do no longer apply) 2013-05-13 20:40:00 -07:00
Bernhard Amann
6c99df508c actually make sqlite work again (tests passed because the writer
was not actually defined because of the define.)
2013-05-13 19:27:11 -07:00
Bernhard Amann
6392acecd2 fix warnings, update baselines, handle rotation 2013-05-12 20:48:17 -07:00
Bernhard Amann
fdc8de7596 add sqlite tests and fix small vector/set escaping bugs 2013-03-11 14:22:35 -07:00
Bernhard Amann
a251a1c39a fix small bug with vectors and sets.
On a first glance - this kind of seems to work. On mac-os you need
a newer than the system-installed sqlite - the hanging problem only
occurs with that one...
2013-03-11 13:10:56 -07:00
Bernhard Amann
5d12765886 make work with newer AsciiFormatter. 2013-03-11 12:01:49 -07:00
Bernhard Amann
0fcc3db9a0 start adding a different text for empty records for the sqlite writer.
Sadly there also seems to be another deadlock issue which I am currently
not really able to figure out - on shutdown sometimes (too often) the main
thread + all sqlite threads wait for semaphores or mutexes.
2013-01-16 18:13:39 -08:00
Bernhard Amann
3415b5fcbe make sqlite support more or less work for logging and input
* add support for &type_column for reading
* add basic tests for logging & input
* clean up a bit
* add support for tables for reading (untested)
2013-01-15 16:01:30 -08:00
Bernhard Amann
d843297a97 make sqlite-writer more stable.
This actually looks quite good...
2013-01-15 11:48:47 -08:00
Bernhard Amann
96aa8776d3 make it compile with new version of AsciiInputOutput 2013-01-13 19:32:12 -08:00
Bernhard Amann
9c09dee294 and adapt to AsciiInputOutput - seems to work... 2012-12-03 14:14:40 -08:00
Bernhard Amann
70a532e898 make it compile 2012-12-03 13:46:48 -08:00
Bernhard Amann
1a1c798738 add SQLite reader.
Probably memleaky as hell, does not support tables/vectors yet, but it
managed to successfully read very simple tables.
2012-10-09 14:30:39 -07:00
Bernhard Amann
d29e691da9 ...adapt to new api... 2012-07-25 15:05:08 -07:00
Bernhard Amann
b8ad4567fb Merge branch 'topic/bernhard/reader-info' into topic/bernhard/sqlite
Now uses optional dbname configuration option

Conflicts:
	scripts/base/frameworks/logging/__load__.bro
	src/logging.bif
2012-07-02 10:13:54 -07:00
Bernhard Amann
c664c40ac2 now the writer supports tables and vectors.
still not tested, but using Log::default_writer=Log::WRITER_SQLITE seems to generate all
the right log-databases, etc.
2012-06-14 15:54:22 -07:00
Bernhard Amann
6e0d15b55e basic sqlite writer seems to work.
does not support table and vector types because SQLite has no support for arrays.
also does not support rotation, etc.

Not really tested thoroughly - but starting bro with Log::default_writer=Log::WRITER_SQLITE
yields a couple of sqlite files that seem to contain sensible stuff.
2012-06-11 11:43:06 -07:00