Commit Graph

137 Commits (41ca206fdfa1a071d5bf18ae2a18e1e4cea583bd)

Author SHA1 Message Date
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
Jason Ish 89634b6508 logging: respect individual log levels
The log level of individual loggers (console, file, syslog) was
being capped by the default log level. For example, if the
default log level was notice, setting the file level to info
would still result in notice level logging.

Bug #3210
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
Victor Julien d00950be81 log/file: use default-log-dir for suricata.log
Default to just suricata.log instead of the full path, so that
in user mode we can log in the user mode location.
8 years ago
Victor Julien d522746c01 windows: fix sc_log_stream_lock handling 8 years ago
Eric Urban 90a0731564 debug/log: add log level for JSON type
resolves #2671
8 years ago
Victor Julien 1bf658f9ee debug/log: suppress coverity checked_return warning 8 years ago
Victor Julien 023a2fe9ab unittests: fix format-truncation warning 8 years ago
Alexander Gozman 10a360280f Print syslog format with SCLogDebug() instead of printf() 9 years ago
Alexander Gozman 5c1a2b53f9 Bug #2466: map SC_LOG_CONFIG level to syslogs LOG_DEBUG 9 years ago
Victor Julien 269cd03a43 console: no color for native windows build 9 years ago
Victor Julien 99bf99c529 output: don't deadlock on log reopen failure
If output log reopen fails, don't try to output the error. This would
lead to a deadlock as reopen was called from a SCLogMessage call. This
call already held the output lock.

Bug #2306.
9 years ago
Victor Julien 81408df0cf output: clean up log API unittests
Disable for MinGW as the setenv/getenv implementations seems to
be undeterministic.
9 years ago
Alexander Gozman 63e1371c8b syslog: treat SC_LOG_PERF messages as LOG_DEBUG
SCLogMapLogLevelToSyslogLevel(): treat SC_LOG_PERF messages as LOG_DEBUG

Previously, when logging to syslog, perf events had a default EMERG priority,
which could be a bit confusing.
9 years ago
Victor Julien 62b8431fdd debug: free pcre memory used for output filtering 9 years ago
Victor Julien 67b97c7948 log: destroy file mutex 9 years ago
Jason Ish fa742d1d14 log: wrap rotation and write in lock
The application log is subject to rotation, so the check for
rotation, the actual rotation and write needs to be done under
lock to ensure the file pointer is in a consisten state
at the time of write().

Fixes issue:
https://redmine.openinfosecfoundation.org/issues/2155
9 years ago
Jason Ish 73388042b2 rust: DNS app-layer.
A DNS application layer in Rust. This is different than the
C based one, as it is partially stateless by not matching
up responses to replies.
10 years ago