1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-25 19:06:39 +02:00
Commit Graph

8291 Commits

Author SHA1 Message Date
Bram Matthys e59cd278cd log { } now uses the new log system and is used for logging to disk,
snomasks, opers, global (remote), ..

For disk logs we currently ignore the sources and log everything.

NOTE: REHASH is untested and will memory leak for sure.
2021-08-07 13:04:07 +02:00
Bram Matthys b8837844fb Newlog: new config plan, ditch set::logging and use log blocks soon.
In this commit it is still called logx { }. Will merge them soon
into one log { } block.
2021-08-07 10:39:54 +02:00
Bram Matthys 2aff2727ed Re-order matching in log_sources_match() for performance. 2021-08-07 09:14:32 +02:00
Bram Matthys 839367272a Rename $client.nuh to $client.details as it is generic detailed
client information and not necessarily nick!user@host in all cases.
2021-08-06 20:59:54 +02:00
Bram Matthys 33a9b745a8 Support client.a.b.c.d etc with "infinite" depth (as long as the
variable is max 255 characters).
This fixes the client connecting notice that previous commit
knowingly broke.
2021-08-06 20:55:57 +02:00
Bram Matthys f38a43434e Newlog: expand client.server more, and also move some stuff to client.user
This means we now have $client.user.username but the expansion system
does not allow items more than 2 deep atm (only $client.something
but not $client.something.other). Will fix later. (TODO)
In the meantime the connection notice will look weird :D
2021-08-06 20:32:35 +02:00
Bram Matthys c22207c4ca Drop cf_ prefix from ConfigFile and ce_ prefix from ConfigEntry structs.
Also rename them to describe better what they do.

ConfigFile:
cf_filename -> filename
cf_next -> next
cf_entries -> items

ConfigEntry:
ce_fileptr -> file
ce_varlinenum -> line_number
ce_fileposstart -> file_position_start
ce_fileposend -> file_position_end
ce_sectlinenum -> section_linenumber
ce_varname -> name
ce_vardata -> value
ce_cond -> conditional_config
ce_entries -> items
ce_next -> next
ce_prevlevel -> parent

Also add doxygen docs for both structs.
2021-08-06 17:50:45 +02:00
Bram Matthys 3eef42c385 Let's log everything except ULOG_DEBUG on the console when booting.
Better than missing an important message.
2021-08-06 16:24:44 +02:00
Bram Matthys 6d216c3a90 Validate set::logging better. 2021-08-06 15:47:51 +02:00
Bram Matthys 1b00ea9137 Fix module not loading using config_status() instead of config_error()
which wasn't logged on the console.
2021-08-06 15:47:24 +02:00
Bram Matthys 9c210ba3fa Merge branch 'unreal60_dev' of github.com:syzop/unrealircd-next into unreal60_dev 2021-08-06 15:27:46 +02:00
Bram Matthys e75ea8d00e Temporarily send to all opers if there is no matching set::logging::snomask
nor set::logging::all-opers configuration.

This so you at least have logging for now ;D
2021-08-06 15:27:03 +02:00
k4be 50eaee19a7 Merge branch 'unreal60_dev' into unreal60_dev+watch 2021-08-06 15:25:13 +02:00
k4be 55a5574a4b Merge branch 'unreal60_dev' into unreal60_dev+watch 2021-08-06 15:23:37 +02:00
Bram Matthys 4c3fa999a7 use 'all-opers' (not 'all-ircops') to be consistent. 2021-08-06 15:23:17 +02:00
Bram Matthys f34d3bd861 Add set::logging block and the logging to snomask mapping.
Note that without such a block nothing will be sent to ircops at all
(anything that comes from unreal_log anyway).
In a later commit either a snomasks.default.conf will be added and/or
an internal default mapping.

This also moves the recursion trap to earlier in the logging code,
which has the side effect that debug traffic regarding snomasks is
no longer logged.
2021-08-06 15:19:36 +02:00
Bram Matthys e9ffeb2d33 Newlog: validate log level, event id and subsystem now. We crash immediately
when any of these are wrong. Obviously this should probably be changed to
only do it in DEBUGMODE in a final stable release :D

We also crash if 'msg' contains a percent sign ('%'). This is to avoid
mistakes where someone uses eg '%s' in there, which is not supported.
Unfortunately it also prevents stuff like '100%' so this should probably
be removed too at some point.
2021-08-06 11:50:28 +02:00
Bram Matthys bfe9fc49e4 Fix non-JSON logging (set type 'text' by default) 2021-08-06 11:29:49 +02:00
Bram Matthys 065d24e248 In register_user() use client->user->XXX instead of user->XXX.
Has always been annoying me.. :D
2021-08-06 11:11:09 +02:00
Bram Matthys 92757f6d9f Newlog: convert local client connects and disconnects.
Also makes the connect message and the standard log message consistent.
2021-08-06 11:05:59 +02:00
Bram Matthys f3035a49f8 Newlog (JSON): enrich client object with 'reputation' and 'security-groups'.
The former is an integer and may not always be available (eg: very early
before the user is connected). The latter is an array.

TODO: opt-in/out of all these expansions as they come at a performance penalty
2021-08-06 11:04:22 +02:00
Bram Matthys 4a72b8f519 Remove unnecessary debugging/benchmark info from eos, channeldb, reputation, tkldb 2021-08-06 10:32:42 +02:00
Bram Matthys 088996b16e Make ulining an UnrealIRCd server a fatal link error instead of a warning.
https://www.unrealircd.org/docs/FAQ#bad-ulines
2021-08-06 09:39:09 +02:00
Bram Matthys ddf639836b Cleanup server.c: make server_sync() function only do the syncing and
move the parts that deal with adding lists, tagging as uline etc back
to the caller, that is.. cmd_server().
2021-08-06 09:36:38 +02:00
Bram Matthys 4de2fa648f Some more server_sync cleanups 2021-08-06 09:32:59 +02:00
Bram Matthys 64f62adb1b Code cleanup in server_sync(): cptr -> client 2021-08-06 09:29:29 +02:00
Bram Matthys cb14b987b6 Newlog: server.c 2021-08-06 09:26:33 +02:00
Bram Matthys cfccc8f05c Add $client.servername. Also add json_string_possibly_null() which is
a wrapper that will return a 'null' JSON object for null strings and
otherwise a string object for non-NULL. It seems by default this is
not the case which is a bit annoying. Maybe we should re-wrap all
code to use this. We'll see.
The problem is when this is not done, then a $variable won't be
expanded and would show up like literally "$variable" as if the
variable was never passed on.
2021-08-06 09:24:24 +02:00
Bram Matthys 5b44baab1f ULOG_WARN -> ULOG_WARNING. Better be consistent. This was the only
ULOG_* level that used an abbreviated term.
2021-08-06 08:50:45 +02:00
Bram Matthys e29fd0afdc Show [debug] instead of [???] 2021-08-05 20:43:02 +02:00
Bram Matthys 29e4f8d56f Newlog: FLOOD_BLOCKED (+s +f notices) 2021-08-05 20:42:24 +02:00
Bram Matthys 970c138711 Remove fullstatus-on-load from antirandom example conf 2021-08-05 20:24:50 +02:00
Bram Matthys 01e86d547d Cleanup antirandom a bit (hardly used status on load option, and
lots of debugging). Also add newlog.
2021-08-05 20:16:27 +02:00
Bram Matthys 55f2ef502e Newlog: add $client.info (gecos/realname for users, info on servers) 2021-08-05 20:16:09 +02:00
Bram Matthys 0bdf1e3c35 Newlog: tls_antidos 2021-08-05 20:15:54 +02:00
Bram Matthys e341903e53 Newlog: update connthrottle 2021-08-05 17:46:24 +02:00
Bram Matthys d3bd525eef Fix "You were forced to part" message on SAPART that was accidentally deleted 2021-08-05 17:30:36 +02:00
Bram Matthys 4115eaf483 Use memory pool for channels 2021-08-05 17:20:24 +02:00
Bram Matthys 6ba6a8fd9a Fix memory leak due to unreal_log() / unreal_log_raw() last argument
being NULL. This is a vararg argument and it causes a leak when
running in debug mode because we add some magic source file,
source line number and function.

Note to self: don't put NULL there :D
2021-08-05 17:05:25 +02:00
Bram Matthys 3c7112469b Drop 2nd argument to find_channel which was always NULL everywhere anyway. 2021-08-05 17:02:39 +02:00
Bram Matthys 8dd6640bf5 Rename get_channel() to make_channel() to match make_user() and
change some more calls to make_channel() to use find_channel().
Also make it take 1 argument instead of 3.

Needed to be careful in sjoin code since the previous code set
channel->creationtime to 0 if client was a remote. Now merged
a few if's into one. Should be correct :D.
2021-08-05 16:55:28 +02:00
Bram Matthys cf1a5c7090 Replace get_channel() calls with !NOCREATE or 0 with find_channel() 2021-08-05 16:43:33 +02:00
Bram Matthys da07fbf28f Make Channel struct fixed-size rather than the name[1] trick.
Also, do some more validations on remote names now that it is fixed.
2021-08-05 16:40:26 +02:00
Bram Matthys 6bad375ad7 Rename channel->chname to channel->name. 2021-08-05 16:34:45 +02:00
Bram Matthys a118a3313d Newlog: SAPART/SAJOIN and also broadcast SAJOIN now so all servers can log
it appropriately.
2021-08-05 16:30:14 +02:00
Bram Matthys b21048c3e1 Broadcast SAPART so other servers now it is a forced part and can log it
appropriately.
2021-08-05 16:24:38 +02:00
Bram Matthys 149beb10e3 Update sajoin logging: use $channels rather than $channel since it may be a list. 2021-08-05 16:11:43 +02:00
Bram Matthys bda671fa14 Newlog: Add ULOG_DEBUG log level, and update reputation.c to use newlog. 2021-08-05 14:17:39 +02:00
Bram Matthys 53fa3c44f5 Remove /REHASH -motd and -opermotd and get rid of some rehash quirks. 2021-08-05 14:00:37 +02:00
Bram Matthys 5e94b1cddb Newlog updates in serv.c 2021-08-05 13:49:36 +02:00