Commit Graph

33 Commits (51ec980e803002aba695dc91c542646b64d7ded4)

Author SHA1 Message Date
Victor Julien edd2cd626f jansson: remove HAVE_LIBJANSSON guards 7 years ago
Victor Julien c769909dad eve/stats: update warning for new default behavior 7 years ago
Victor Julien 76e1836aed counters: improve handling missing global config
Improve warnings when eve.stats can't work because of the global config
missing or disabled.

Issue warning if global config is missing but stats are still enabled due
to the legacy stats.log.

Issue clearer warning when stats are disabled and unix socket dump-counters
command is issued.

Warnings include links to docs.

Bug #2465.
7 years ago
Victor Julien 2da90a1cd8 posix: remove deprecated index/rindex calls
Replace index by strchr and rindex by strrchr.

index(3) states "POSIX.1-2008 removes the specifications of index() and
rindex(), recommending strchr(3) and strrchr(3) instead."

Add index/rindex to banned function check so they don't get reintroduced.

Bug #1443.
7 years ago
Jeff Lucovsky 3d5eccf084 output/json: Refactor output buffer size macro 7 years ago
Victor Julien fb18a1655c eve.stats: warn that output might miss decoder-events 8 years ago
Jason Ish 00e6cd4ced output: introduce init return type
The new OutputInitResult is a struct return type that allows
logger init functions to return a NULL context without
raising error.

Instead of returning NULL to signal error, the "ok" field will
be set to false. If ok, but the ctx is NULL, then silently
move on to the next logger.

Use case: multiple versions of a specific logger, and one
implementation decides the configuration is not for that
implemenation. It can return NULL, ok.
9 years ago
Jason Ish c4d30ddaf9 eve: fix context datatype used in init functions
Many were using AlertJsonThread instead of OutputJsonCtx,
but as the datatypes were similar enough no harm was done.

Now that they are using their proper datatype, removed
AlertJsonThread from output.h as its no longer used.
9 years ago
Giuseppe Longo 720cfcfcca json-stats: print engine stats
This adds the engine stats in stats event.
If multi-tenancy is enabled, it will add
stats for each tenant

The following is a snippet of the generated EVE entry:

"detect":{"engines":[{"last_reload":"2015-10-13T09:59:48.044996+0200","rules_loaded":17184,"rules_failed":0}],"alert":28}

Multi-tenancy enabled:

"detect":{"engines":[{"id":1,"last_reload":"2015-10-13T09:56:46.447153+0200","rules_loaded":17084,"rules_failed":0},
                     {"id":2,"last_reload":"2015-10-13T09:56:36.504877+0200","rules_loaded":3268,"rules_failed":0}],
                     "alert":28}
9 years ago
Sascha Steinbiss d9c7f9bb17 stats: use unshortened interface names in counters 9 years ago
Sascha Steinbiss 4d25593b4a json: skip over double dots in output tokenizing
Interface name shortening introduces double periods ('..') as spacers,
which cause issues during JSON stats serialization as there '.'
characters are also used as separators to define nesting of the JSON
output. This commit makes sure that '..' are skipped during tokenizing.
Fixes Redmine bug #2208.
9 years ago
Victor Julien ab1200fbd7 compiler: more strict compiler warnings
Set flags by default:

    -Wmissing-prototypes
    -Wmissing-declarations
    -Wstrict-prototypes
    -Wwrite-strings
    -Wcast-align
    -Wbad-function-cast
    -Wformat-security
    -Wno-format-nonliteral
    -Wmissing-format-attribute
    -funsigned-char

Fix minor compiler warnings for these new flags on gcc and clang.
9 years ago
Jason Ish 3fab684f97 logging: don't log that json is disabled in each logger
A warning log is already emitted if eve-log is enabled in the
configuration but json support is not built so the logger
registration functions can be silent.
10 years ago
Jason Ish 1b4ba4496c logging: rename registration functions to not have tmm
As the logging modules are no longer threading modules, rename
them so they don't look like they are being registered as
threading modules.

Also, move the registration to the output.c which will handle
registration of the loggers.
10 years ago
Jason Ish fa27a76462 logging: add profiling back for non-tmm loggers
The loggers moved away from a TMM required a new
profiling support.
10 years ago
Jason Ish b580016c80 logging: convert stats loggers to non-thread module 10 years ago
maxtors 06d74b5775 Module specific error code for init ctx error. 10 years ago
maxtors 69863f7b1c Corrected and unified debugmessages for init data errors in *ThreadInit. 10 years ago
Victor Julien 14030239f8 unix-socket: restore dump-counters functionality
Create a eve.stats like output for dump-counters.
11 years ago
Victor Julien 310e8fcbf8 stats: export StatsToJSON 11 years ago
Victor Julien ffdfb6a8f0 json-stats: split out json generation
Split out JSON generation logic so the code becomes reusable.
11 years ago
Victor Julien c446abeb47 jansson: include in suricata-common.h 11 years ago
Victor Julien 8bb1cf08ef eve: fix mishandling of big messages
When the string representation of a JSON message grew bigger than
64k, the JSON record would just be truncated. This lead to errors
in the parser(s) of the JSON stream.

This patch changes the buffer logic to grow the buffer on demand.
11 years ago
Maxtors 4b8bd9dfc9 Added checking of negated "totals" and "threads" config values for stats. 11 years ago
Jason Ish b512580bbe logging: integrate rotation into SCConfLogOpenGeneric.
Addresses issue 1492, and will make it harder to omit
rotation on new outputs.
11 years ago
Jason Ish e3ce29f694 json-stats: log deltas
If "deltas" is yes, log delta values as the name of the value
suffixed with _delta.
11 years ago
Jason Ish 7c40c73482 json-stats: reorg threads and totals
Totals are now placed at the top level instead of under a "Total"
object.

Threads are placed under a "threads" object.
11 years ago
Jason Ish 1f2caf78c3 json-stats: log uptime in seconds, instead of a string 11 years ago
Victor Julien 2c9a2c8327 stats: support per thread stats in json output
Default is only to output totals. Optionally per thread can be added.

Both can be enabled together.
11 years ago
Victor Julien 175831331c stats json: replace strndup
strndup is a banned function.
11 years ago
Victor Julien 6565c86f96 stats-json: fixes and improvements
Use proper LogFileCtx and MemBuffer handling so we can have multiple
loggers active at the same time.

Change 'date' field to timestamp, and use ISO notation to make it
the same as the other JSON outputs.
11 years ago
Tom DeCanio e4e07d0c3b eve-log: stats logging code cleanup. 11 years ago
Tom DeCanio 117eed0385 eve-log: add JSON stats logging
Support for counters in stats.log in eve output JSON stream.
11 years ago