Commit Graph

154 Commits (06b70817b268e7a0104f0cfa5038376d9b07cffb)

Author SHA1 Message Date
Philippe Antoine de335ba98a src: do not include "util-time.h" directly
It is included in suricata-common.h

Ticket: 945
3 weeks ago
Philippe Antoine 6bb271cee9 conf: uses SCConfGetNonNull
Ticke: 8651

Uses it in place when we dereferenced the value straight away
after checking SCConfGet result but not its value
5 months ago
Jeff Lucovsky e80e881335 main/options: display level name, not numeric
Issue: 7389

Follow-up change for verbose handling. Instead of displaying the numeric
verbose level, display the level name.

I.e., instead of 4, display Debug
11 months ago
Philippe Antoine 42d6c85757 util/debug: debug validation about stack allocation
Ticket: 8001
12 months ago
Victor Julien b7650a45fa output: fix long logline test
Fixes: 023a2fe9ab ("unittests: fix format-truncation warning")
1 year ago
Philippe Antoine ad0f6e388e src: remove BUG_ON in packet path
Transforms them into debug validations

Ticket: 1484

Packet path is here considered FlowWorker and all lines
covered by SV tests are here fixed
1 year ago
Victor Julien a8b342a07b debug: suppress cppcheck warning
src/util-debug.c:1562:5: warning: Either the condition 'sc_lid!=NULL' is redundant or there is possible null pointer dereference: sc_lid. [nullPointerRedundantCheck]
    sc_lid->global_log_level = MAX(sc_lid->global_log_level, max_level);
    ^
src/util-debug.c:1569:16: note: Assuming that condition 'sc_lid!=NULL' is not redundant
    if (sc_lid != NULL)
               ^
src/util-debug.c:1562:5: note: Null pointer dereference
    sc_lid->global_log_level = MAX(sc_lid->global_log_level, max_level);
    ^
2 years ago
Jason Ish 155706f96b jsonbuilder: prefix C API with SC 2 years ago
Jason Ish 22b77b0c56 conf: prefix conf API with SC 2 years ago
Philippe Antoine 359f736542 util: fix -Wshorten-64-to-32 warnings
Ticket: #6186
2 years ago
Shivani Bhardwaj 015da2c7ed rust: add C callback for FatalErrorOnInit 2 years ago
Jason Ish 2bcc66da58 rust/log: move rust log and debug utils to debug module
Move Rust logging, and debug_validation to a debug module to mirrow
the C side.
2 years ago
Philippe Antoine 20423fdd38 style: remove some useless return
and remove empty line before end of function
2 years ago
Jeff Lucovsky 36e5792501 debug/bool: Switch use_color to a bool 3 years ago
Victor Julien 67634c561c time: don't log debug messages from debug logging
Bug: #5835.

Fixes: 31793aface ("time: Replace struct timeval with scalar value")
4 years ago
Jeff Lucovsky 31793aface time: Replace struct timeval with scalar value
Issue: 5718

This commit switches the majority of time handling to a new type --
SCTime_t -- which is a 64 bit container for time:
- 44 bits -- seconds
- 20 bits -- useconds
4 years ago
Victor Julien ee6c39b985 output: improve debug format by adding function name 4 years ago
Victor Julien ebd8728219 src: fix strict-prototype warnings
Tested on Fedora 37 with clang 15.

app-layer.c:1055:27: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void AppLayerSetupCounters()
                          ^
                           void
app-layer.c:1176:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void AppLayerDeSetupCounters()
                            ^
                             void
2 errors generated.
4 years ago
Jason Ish bac8b8d26d logging: add new date format: YYYY-MM-DD HH:MM:SS
Adds a new logging format character, %z that uses a more standard time
format of "YYYY-MM-DD HH:MM:SS".

Ticket #5764
4 years ago
Victor Julien a4eefd16b7 output: add %M format option for the log message body
If %M is not specified, it is automatically appended to the format
string, to provide backwards compatibility.
4 years ago
Victor Julien da5fa24ab2 pcap: output cleanups 4 years ago
Victor Julien 1db4dc4fcb output: default output format
Add a separate default for file output.
4 years ago
Victor Julien 5b58be6076 output: remove unused log levels
Critical, alert and emergency were unused, so remove.
4 years ago
Victor Julien 8a3c8984b4 output: print detect-engine as detect 4 years ago
Victor Julien 199e444498 output/capture: group source and runmode
So outputs from runmode-af-packet and source-af-packet both will
show 'af-packet' as the module.
4 years ago
Victor Julien 1b755653c0 output: add %D for compact log level 4 years ago
Jeff Lucovsky 2c9c18a9d0 log/json: Convert log output to use JsonBuilder
This commit converts the file logging logic to use JsonBuilder instead
of libjansson.
4 years ago
Jeff Lucovsky 3a37cf4507 log: Use SCCalloc instead of alloc/clear 4 years ago
Jeff Lucovsky f8474344cd log: Add module and subsystem identifiers to log
Issue: 2497

This changeset provides subsystem and module identifiers in the log when
the log format string contains "%S". By convention, the log format
surrounds "%S" with brackets.

The subsystem name is generally the same as the thread name. The module
name is derived from the source code module name and usually consists of
the first one or 2 segments of the name using the dash character as the
segment delimiter.
4 years ago
Victor Julien 806104c09a output: issue warning if file can't be opened 4 years ago
Victor Julien 79c84211d5 output: remove all custom errors 4 years ago
Victor Julien b31ffde6f4 output: remove error codes from output 4 years ago
Victor Julien 70b69a3171 output: minor code cleanups 4 years ago
Jeff Lucovsky 82158f92c1 general: Correct typos 4 years ago
Victor Julien 39cf5b151a src: includes cleanup
Work towards making `suricata-common.h` only introduce system headers
and other things that are independent of complex internal Suricata
data structures.

Update files to compile after this.

Remove special DPDK handling for strlcpy and strlcat, as this caused
many compilation failures w/o including DPDK headers for all files.

Remove packet macros from decode.h and move them into their own file,
turn them into functions and rename them to match our function naming
policy.
4 years ago
Philippe Antoine 02f2602dde src: rework includes as per cppclean 4 years ago
Philippe Antoine 875eb58fb0 file: use functions on fd to avoid toctou
Ticket: #5308
4 years ago
Victor Julien 1c8559b3ab debug: support %m output format again
Use thread local storage to avoid the previous dead lock issues.
5 years ago
Jason Ish 59ac1fe277 logging: change ownership of application log if needed
When running with privilege dropping, the application log file
is opened before privileges are dropped resulting in Suricata
failing to re-open the file for file rotation.

If needed, chown the application to the run-as user/group after
opening.

Ticker #4523
5 years ago
Philippe Antoine 3633c48e6e pcre2: migrate utility uses of pcre 5 years ago
Jason Ish 87a91e6aa8 logging: expose the log level with a function
The log level needs to exposed so Rust plugins can bootstrap
themselves with the correct login to SCLogNotice!(), etc work
as expected.
6 years ago
Shivani Bhardwaj 6f7d8e50c8 src: use FatalError whenever possible
Replaces all patterns of SCLogError() followed by exit() with
FatalError(). Cocci script to do this:

@@
constant C;
constant char[] msg;
@@

- SCLogError(C,
+ FatalError(SC_ERR_FATAL,
  msg);
- exit(EXIT_FAILURE);

Closes redmine ticket 3188.
6 years ago
Victor Julien 8f2df0f938 logging: fix default log format for release mode 7 years ago
Victor Julien 481a1923b4 logging: turn SCLog and SCLogErr into funcs
Reduces compiled code size.
7 years ago
Philippe Antoine 12a3a24906 log: can use a file set from env variable
Enables the redirection of log to a file set by an environment
variable SC_LOG_FILE when SC_LOG_OP_IFACE=file
7 years ago
Danny Browning b573c16dd5 build: cbindgen
Rust headers are now generated using cbindgen. If cbindgen is present, they can
be generated during dist, otherwise they will be available for builds.
7 years ago
Victor Julien 842037d327 jansson: remove explicit <jansson.h> includes
Header is included from suricata-common.h
7 years ago
Victor Julien edd2cd626f jansson: remove HAVE_LIBJANSSON guards 7 years ago
Victor Julien 5e9714e384 rust: remove all HAVE_RUST guards 7 years ago
Jason Ish 71c53484ee logging: used fixed levels of verbosity for -v, -vv...
Change the meaning of the verbosity flag to change the log
level to fixed levels instead of being relative to whats
configured.

-v    => INFO
-vv   => PERF
-vvv  => CONIFG
-vvvv => DEBUG

But do now allow -v to decrease the verbosity.

Bug #1851
7 years ago