Completely Overhaul Logging

This is a merged port from /tg/station and Virgo on logging standards.
The diary has been replaced with GLOB.world_game_log, diaryofmeanpeople
is gone (because it wasn't actually used) and a whole bunch of logging
procs have been changed to optimize Splunk.
This commit is contained in:
tigercat2000
2018-04-19 07:22:44 -08:00
parent 604f26f2ec
commit c03621c508
166 changed files with 1267 additions and 3984 deletions
+8 -9
View File
@@ -1,11 +1,11 @@
//Blocks an attempt to connect before even creating our client datum thing.
world/IsBanned(key,address,computer_id)
if(!key || !address || !computer_id)
log_access("Failed Login (invalid data): [key] [address]-[computer_id]")
log_adminwarn("Failed Login (invalid data): [key] [address]-[computer_id]")
return list("reason"="invalid login data", "desc"="Error: Could not check ban status, please try again. Error message: Your computer provided invalid or blank information to the server on connection (BYOND Username, IP, and Computer ID). Provided information for reference: Username: '[key]' IP: '[address]' Computer ID: '[computer_id]'. If you continue to get this error, please restart byond or contact byond support.")
if(text2num(computer_id) == 2147483647) //this cid causes stickybans to go haywire
log_access("Failed Login (invalid cid): [key] [address]-[computer_id]")
log_adminwarn("Failed Login (invalid cid): [key] [address]-[computer_id]")
return list("reason"="invalid login data", "desc"="Error: Could not check ban status, Please try again. Error message: Your computer provided an invalid Computer ID.")
var/admin = 0
var/ckey = ckey(key)
@@ -16,13 +16,13 @@ world/IsBanned(key,address,computer_id)
//Guest Checking
if(!guests_allowed && IsGuestKey(key))
log_access("Failed Login: [key] [computer_id] [address] - Guests not allowed")
log_adminwarn("Failed Login: [key] [computer_id] [address] - Guests not allowed")
// message_admins("<span class='notice'>Failed Login: [key] - Guests not allowed</span>")
return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a BYOND account.")
//check if the IP address is a known Tor node
if(config.ToRban && ToRban_isbanned(address))
log_access("Failed Login: [key] [computer_id] [address] - Banned: Tor")
log_adminwarn("Failed Login: [key] [computer_id] [address] - Banned: Tor")
message_admins("<span class='adminnotice'>Failed Login: [key] - Banned: Tor</span>")
//ban their computer_id and ckey for posterity
AddBan(ckey(key), computer_id, "Use of Tor", "Automated Ban", 0, 0)
@@ -41,14 +41,13 @@ world/IsBanned(key,address,computer_id)
message_admins("<span class='adminnotice'>The admin [key] has been allowed to bypass a matching ban on [.["key"]]</span>")
addclientmessage(ckey,"<span class='adminnotice'>You have been allowed to bypass a matching ban on [.["key"]].</span>")
else
log_access("Failed Login: [key] [computer_id] [address] - Banned [.["reason"]]")
log_adminwarn("Failed Login: [key] [computer_id] [address] - Banned [.["reason"]]")
return .
else
var/ckeytext = ckey(key)
if(!establish_db_connection())
log_to_dd("Ban database connection failure. Key [ckeytext] not checked")
diary << "Ban database connection failure. Key [ckeytext] not checked"
log_world("Ban database connection failure. Key [ckeytext] not checked")
return
var/ipquery = ""
@@ -100,7 +99,7 @@ world/IsBanned(key,address,computer_id)
. = list("reason"="[bantype]", "desc"="[desc]")
log_access("Failed Login: [key] [computer_id] [address] - Banned [.["reason"]]")
log_adminwarn("Failed Login: [key] [computer_id] [address] - Banned [.["reason"]]")
return .
. = ..() //default pager ban stuff
@@ -114,6 +113,6 @@ world/IsBanned(key,address,computer_id)
addclientmessage(ckey,"<span class='adminnotice'>You have been allowed to bypass a matching host/sticky ban.</span>")
return null
else
log_access("Failed Login: [key] [computer_id] [address] - Banned [.["message"]]")
log_adminwarn("Failed Login: [key] [computer_id] [address] - Banned [.["message"]]")
return .
+3 -3
View File
@@ -22,7 +22,7 @@
/proc/ToRban_update()
spawn(0)
diary << "Downloading updated ToR data..."
log_world("Downloading updated ToR data...")
var/http[] = world.Export("http://exitlist.torproject.org/exit-addresses")
var/list/rawlist = file2list(http["CONTENT"])
@@ -36,11 +36,11 @@
if(!cleaned) continue
F[cleaned] << 1
to_chat(F["last_update"], world.realtime)
diary << "ToR data updated!"
log_world("ToR data updated!")
if(usr)
to_chat(usr, "ToRban updated.")
return 1
diary << "ToR data update aborted: no data."
log_world("ToR data update aborted: no data.")
return 0
/client/proc/ToRban(task in list("update","toggle","show","remove","remove all","find"))
+3 -5
View File
@@ -4,14 +4,12 @@ var/global/nologevent = 0
////////////////////////////////
/proc/message_admins(var/msg)
msg = "<span class=\"admin\"><span class=\"prefix\">ADMIN LOG:</span> <span class=\"message\">[msg]</span></span>"
log_adminwarn(msg)
for(var/client/C in admins)
if(R_ADMIN & C.holder.rights)
if(C.prefs && !(C.prefs.toggles & CHAT_NO_ADMINLOGS))
to_chat(C, msg)
/proc/msg_admin_attack(var/text) //Toggleable Attack Messages
log_attack(text)
if(!nologevent)
var/rendered = "<span class=\"admin\"><span class=\"prefix\">ATTACK:</span> <span class=\"message\">[text]</span></span>"
for(var/client/C in admins)
@@ -866,13 +864,13 @@ var/global/nologevent = 0
for(var/mob/living/silicon/S in mob_list)
ai_number++
if(isAI(S))
to_chat(usr, "<b>AI [key_name(S, usr)]'s laws:</b>")
to_chat(usr, "<b>AI [key_name(S, TRUE)]'s laws:</b>")
else if(isrobot(S))
var/mob/living/silicon/robot/R = S
to_chat(usr, "<b>CYBORG [key_name(S, usr)]'s [R.connected_ai?"(Slaved to: [R.connected_ai])":"(Independent)"] laws:</b>")
to_chat(usr, "<b>CYBORG [key_name(S, TRUE)]'s [R.connected_ai?"(Slaved to: [R.connected_ai])":"(Independent)"] laws:</b>")
else if(ispAI(S))
var/mob/living/silicon/pai/P = S
to_chat(usr, "<b>pAI [key_name(S, usr)]'s laws:</b>")
to_chat(usr, "<b>pAI [key_name(S, TRUE)]'s laws:</b>")
to_chat(usr, "[P.pai_law0]")
if(P.pai_laws)
to_chat(usr, "[P.pai_laws]")
+2 -2
View File
@@ -40,8 +40,8 @@
if("hrefs") //persistant logs and stuff
if(config && config.log_hrefs)
if(href_logfile)
src << browse(href_logfile,"window=investigate[subject];size=800x300")
if(GLOB.world_href_log)
src << browse(GLOB.world_href_log,"window=investigate[subject];size=800x300")
else
to_chat(src, "<font color='red'>Error: admin_investigate: No href logfile found.</font>")
return
+2 -4
View File
@@ -104,8 +104,7 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
establish_db_connection()
if(!dbcon.IsConnected())
log_to_dd("Failed to connect to database in load_admins(). Reverting to legacy system.")
diary << "Failed to connect to database in load_admins(). Reverting to legacy system."
log_world("Failed to connect to database in load_admins(). Reverting to legacy system.")
config.admin_legacy_system = 1
load_admins()
return
@@ -124,8 +123,7 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
//find the client for a ckey if they are connected and associate them with the new admin datum
D.associate(directory[ckey])
if(!admin_datums)
log_to_dd("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
diary << "The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system."
log_world("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
config.admin_legacy_system = 1
load_admins()
return
-2
View File
@@ -27,8 +27,6 @@ var/list/admin_verbs_admin = list(
/client/proc/cmd_admin_subtle_message, /*send an message to somebody as a 'voice in their head'*/
/client/proc/cmd_admin_delete, /*delete an instance/object/mob/etc*/
/client/proc/cmd_admin_check_contents, /*displays the contents of an instance*/
/client/proc/giveruntimelog, /*allows us to give access to runtime logs to somebody*/
/client/proc/getruntimelog, /*allows us to access runtime logs to somebody*/
/client/proc/getserverlog, /*allows us to fetch server logs (diary) for other days*/
/client/proc/jumptocoord, /*we ghost and jump to a coordinate*/
/client/proc/Getmob, /*teleports a mob to our location*/
+1 -2
View File
@@ -52,8 +52,7 @@ DEBUG
log_admin("appearance_keylist was empty")
else
if(!establish_db_connection())
log_to_dd("Database connection failed. Reverting to the legacy ban system.")
diary << "Database connection failed. Reverting to the legacy ban system."
log_world("Database connection failed. Reverting to the legacy ban system.")
config.ban_legacy_system = 1
appearance_loadbanfile()
return
+1 -2
View File
@@ -78,8 +78,7 @@ DEBUG
log_runtime(EXCEPTION("Skipping malformed job ban: [s]"))
else
if(!establish_db_connection())
log_to_dd("Database connection failed. Reverting to the legacy ban system.")
diary << "Database connection failed. Reverting to the legacy ban system."
log_world("Database connection failed. Reverting to the legacy ban system.")
config.ban_legacy_system = 1
jobban_loadbanfile()
return
+7 -7
View File
@@ -88,7 +88,7 @@
//get message text, limit it's length.and clean/escape html
if(!msg)
msg = input(src,"Message:", "Private message to [key_name(C, 0, 0)]") as text|null
msg = input(src,"Message:", "Private message to [key_name(C, 0)]") as text|null
if(!msg)
return
@@ -152,9 +152,9 @@
var/emoji_msg = "<span class='emoji_enabled'>[msg]</span>"
recieve_message = "<span class='[recieve_span]'>[type] from-<b>[recieve_pm_type][key_name(src, C, C.holder ? 1 : 0, type)]</b>: [emoji_msg]</span>"
recieve_message = "<span class='[recieve_span]'>[type] from-<b>[recieve_pm_type][key_name(src, TRUE, type)]</b>: [emoji_msg]</span>"
to_chat(C, recieve_message)
to_chat(src, "<font color='blue'>[send_pm_type][type] to-<b>[key_name(C, src, holder ? 1 : 0, type)]</b>: [emoji_msg]</font>")
to_chat(src, "<font color='blue'>[send_pm_type][type] to-<b>[key_name(C, TRUE, type)]</b>: [emoji_msg]</font>")
/*if(holder && !C.holder)
C.last_pm_recieved = world.time
@@ -175,13 +175,13 @@
switch(type)
if("Mentorhelp")
if(check_rights(R_ADMIN|R_MOD|R_MENTOR, 0, X.mob))
to_chat(X, "<span class='mentorhelp'>[type]: [key_name(src, X, 0, type)]-&gt;[key_name(C, X, 0, type)]: [emoji_msg]</span>")
to_chat(X, "<span class='mentorhelp'>[type]: [key_name(src, TRUE, type)]-&gt;[key_name(C, TRUE, type)]: [emoji_msg]</span>")
if("Adminhelp")
if(check_rights(R_ADMIN|R_MOD, 0, X.mob))
to_chat(X, "<span class='adminhelp'>[type]: [key_name(src, X, 0, type)]-&gt;[key_name(C, X, 0, type)]: [emoji_msg]</span>")
to_chat(X, "<span class='adminhelp'>[type]: [key_name(src, TRUE, type)]-&gt;[key_name(C, TRUE, type)]: [emoji_msg]</span>")
else
if(check_rights(R_ADMIN|R_MOD, 0, X.mob))
to_chat(X, "<span class='boldnotice'>[type]: [key_name(src, X, 0, type)]-&gt;[key_name(C, X, 0, type)]: [emoji_msg]</span>")
to_chat(X, "<span class='boldnotice'>[type]: [key_name(src, TRUE, type)]-&gt;[key_name(C, TRUE, type)]: [emoji_msg]</span>")
//Check if the mob being PM'd has any open admin tickets.
var/tickets = list()
@@ -226,4 +226,4 @@
if(X == src)
continue
if(check_rights(R_ADMIN|R_MOD|R_MENTOR, 0, X.mob))
to_chat(X, "<B><font color='blue'>PM: [key_name(src, X, 0)]-&gt;IRC-Admins:</B> <span class='notice'>[msg]</span></font>")
to_chat(X, "<B><font color='blue'>PM: [key_name(src, TRUE, 0)]-&gt;IRC-Admins:</B> <span class='notice'>[msg]</span></font>")
+2 -2
View File
@@ -7,7 +7,7 @@
msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))
if(!msg) return
log_admin("[key_name(src)] : [msg]")
log_adminsay(msg, src)
if(check_rights(R_ADMIN,0))
for(var/client/C in admins)
@@ -25,7 +25,7 @@
return
msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))
log_admin("MENTOR: [key_name(src)] : [msg]")
log_mentorsay(msg, src)
if(!msg)
return
+1 -1
View File
@@ -17,4 +17,4 @@
to_chat(M, "<font color='#960018'><span class='ooc'><span class='prefix'>AOOC:</span> <EM>[display_name]:</EM> <span class='message'>[msg]</span></span></font>")
log_ooc("(ANTAG) [key] : [msg]")
log_aooc(msg, src)
+3 -47
View File
@@ -14,50 +14,6 @@
*/
//This proc allows Game Masters to grant a client access to the .getruntimelog verb
//Permissions expire at the end of each round.
//Runtimes can be used to meta or spot game-crashing exploits so it's advised to only grant coders that
//you trust access. Also, it may be wise to ensure that they are not going to play in the current round.
/client/proc/giveruntimelog()
set name = ".giveruntimelog"
set desc = "Give somebody access to any session logfiles saved to the /log/runtime/ folder."
set category = null
if(!src.holder)
to_chat(src, "<font color='red'>Only Admins may use this command.</font>")
return
var/client/target = input(src,"Choose somebody to grant access to the server's runtime logs (permissions expire at the end of each round):","Grant Permissions",null) as null|anything in clients
if(!istype(target,/client))
to_chat(src, "<font color='red'>Error: giveruntimelog(): Client not found.</font>")
return
target.verbs |= /client/proc/getruntimelog
to_chat(target, "<font color='red'>You have been granted access to runtime logs. Please use them responsibly or risk being banned.</font>")
return
//This proc allows download of runtime logs saved within the data/logs/ folder by dreamdeamon.
//It works similarly to show-server-log.
/client/proc/getruntimelog()
set name = ".getruntimelog"
set desc = "Retrieve any session logfiles saved by dreamdeamon."
set category = null
var/path = browse_files("data/logs/runtime/")
if(!path)
return
if(file_spam_check())
return
message_admins("[key_name_admin(src)] accessed file: [path]")
src << ftp(file(path))
to_chat(src, "Attempting to send file, this may take a fair few minutes if the file is very large.")
return
//This proc allows download of past server logs saved within the data/logs/ folder.
//It works similarly to show-server-log.
/client/proc/getserverlog()
@@ -87,7 +43,7 @@
set name = "Show Server Log"
set desc = "Shows today's server log."
var/path = "data/logs/[time2text(world.realtime,"YYYY/MM-Month/DD-Day")].log"
var/path = "[GLOB.log_directory]/game.log"
if( fexists(path) )
src << ftp(file(path))
@@ -103,8 +59,8 @@
set name = "Show Server Attack Log"
set desc = "Shows today's server attack log."
var/path = "data/logs/[time2text(world.realtime,"YYYY/MM-Month/DD-Day")] Attack.log"
if( fexists(path) )
var/path = "[GLOB.log_directory]/attack.log"
if(fexists(path))
src << ftp(file(path))
else
+1 -1
View File
@@ -201,7 +201,7 @@
if(rejected)
to_chat(src, "[rejected] out of [count] objects rejected your edit")
log_to_dd("### MassVarEdit by [src]: [O.type] (A/R [accepted]/[rejected]) [variable]=[html_encode("[O.vars[variable]]")]([list2params(value)])")
log_world("### MassVarEdit by [src]: [O.type] (A/R [accepted]/[rejected]) [variable]=[html_encode("[O.vars[variable]]")]([list2params(value)])")
log_admin("[key_name(src)] mass modified [original_name]'s [variable] to [O.vars[variable]] ([accepted] objects modified)")
message_admins("[key_name_admin(src)] mass modified [original_name]'s [variable] to [O.vars[variable]] ([accepted] objects modified)")
+7 -7
View File
@@ -342,7 +342,7 @@ var/list/VVpixelmovement = list("step_x", "step_y", "step_size", "bound_height",
if(!O.vv_edit_var(objectvar, L))
to_chat(src, "Your edit was rejected by the object.")
return
log_to_dd("### ListVarEdit by [src]: [(O ? O.type : "/list")] [objectvar]: ADDED=[var_value]")
log_world("### ListVarEdit by [src]: [(O ? O.type : "/list")] [objectvar]: ADDED=[var_value]")
log_admin("[key_name(src)] modified [original_name]'s [objectvar]: ADDED=[var_value]")
message_admins("[key_name_admin(src)] modified [original_name]'s [objectvar]: ADDED=[var_value]")
@@ -385,7 +385,7 @@ var/list/VVpixelmovement = list("step_x", "step_y", "step_size", "bound_height",
if(!O.vv_edit_var(objectvar, L))
to_chat(src, "Your edit was rejected by the object.")
return
log_to_dd("### ListVarEdit by [src]: [O.type] [objectvar]: CLEAR NULLS")
log_world("### ListVarEdit by [src]: [O.type] [objectvar]: CLEAR NULLS")
log_admin("[key_name(src)] modified [original_name]'s [objectvar]: CLEAR NULLS")
message_admins("[key_name_admin(src)] modified [original_name]'s list [objectvar]: CLEAR NULLS")
return
@@ -395,7 +395,7 @@ var/list/VVpixelmovement = list("step_x", "step_y", "step_size", "bound_height",
if(!O.vv_edit_var(objectvar, L))
to_chat(src, "Your edit was rejected by the object.")
return
log_to_dd("### ListVarEdit by [src]: [O.type] [objectvar]: CLEAR DUPES")
log_world("### ListVarEdit by [src]: [O.type] [objectvar]: CLEAR DUPES")
log_admin("[key_name(src)] modified [original_name]'s [objectvar]: CLEAR DUPES")
message_admins("[key_name_admin(src)] modified [original_name]'s list [objectvar]: CLEAR DUPES")
return
@@ -405,7 +405,7 @@ var/list/VVpixelmovement = list("step_x", "step_y", "step_size", "bound_height",
if(!O.vv_edit_var(objectvar, L))
to_chat(src, "Your edit was rejected by the object.")
return
log_to_dd("### ListVarEdit by [src]: [O.type] [objectvar]: SHUFFLE")
log_world("### ListVarEdit by [src]: [O.type] [objectvar]: SHUFFLE")
log_admin("[key_name(src)] modified [original_name]'s [objectvar]: SHUFFLE")
message_admins("[key_name_admin(src)] modified [original_name]'s list [objectvar]: SHUFFLE")
return
@@ -482,7 +482,7 @@ var/list/VVpixelmovement = list("step_x", "step_y", "step_size", "bound_height",
if(!O.vv_edit_var(objectvar, L))
to_chat(src, "Your edit was rejected by the object.")
return
log_to_dd("### ListVarEdit by [src]: [O.type] [objectvar]: REMOVED=[html_encode("[original_var]")]")
log_world("### ListVarEdit by [src]: [O.type] [objectvar]: REMOVED=[html_encode("[original_var]")]")
log_admin("[key_name(src)] modified [original_name]'s [objectvar]: REMOVED=[original_var]")
message_admins("[key_name_admin(src)] modified [original_name]'s [objectvar]: REMOVED=[original_var]")
return
@@ -501,7 +501,7 @@ var/list/VVpixelmovement = list("step_x", "step_y", "step_size", "bound_height",
if(!O.vv_edit_var(objectvar, L))
to_chat(src, "Your edit was rejected by the object.")
return
log_to_dd("### ListVarEdit by [src]: [(O ? O.type : "/list")] [objectvar]: [original_var]=[new_var]")
log_world("### ListVarEdit by [src]: [(O ? O.type : "/list")] [objectvar]: [original_var]=[new_var]")
log_admin("[key_name(src)] modified [original_name]'s [objectvar]: [original_var]=[new_var]")
message_admins("[key_name_admin(src)] modified [original_name]'s varlist [objectvar]: [original_var]=[new_var]")
@@ -612,7 +612,7 @@ var/list/VVpixelmovement = list("step_x", "step_y", "step_size", "bound_height",
if(!O.vv_edit_var(variable, var_new))
to_chat(src, "Your edit was rejected by the object.")
return
log_to_dd("### VarEdit by [src]: [O.type] [variable]=[html_encode("[var_new]")]")
log_world("### VarEdit by [src]: [O.type] [variable]=[html_encode("[var_new]")]")
log_admin("[key_name(src)] modified [original_name]'s [variable] to [var_new]")
var/msg = "[key_name_admin(src)] modified [original_name]'s [variable] to [var_new]"
message_admins(msg)