Jump to content
TrinityCore

Logging chat into database


jake
 Share

Recommended Posts

Hi there,

I've been scouring documentation and been through a few emulation sites looking for a proper answer to this. But is there any way I can log chat into the databases?

I've tried playing with loggers and appenders but I can't seem to get it working. I'm just looking to log all chat data from my players into the database.

Thanks for any help in advance.

Link to comment
Share on other sites

7 hours ago, Rochet2 said:

Check this out, maybe it helps:

I know that example is just for GM logging, but it probably applies to chat as well.
Probably a good idea to first get chat to log into a file.
And only then look into getting it in to DB.

I am not sure how much it's changed from a couple of years ago when I looked at it, but chat was handled server<->client side and wasn't recorded anywhere. I believe in order to log it to either file or database you would need to modify core to first log it, as I think right now it just relays to the needed clients when the server receives it.

Link to comment
Share on other sites

39 minutes ago, ex0r said:

I am not sure how much it's changed from a couple of years ago when I looked at it, but chat was handled server<->client side and wasn't recorded anywhere. I believe in order to log it to either file or database you would need to modify core to first log it, as I think right now it just relays to the needed clients when the server receives it.

It should be loggable like many other things. Have you looked at the loggers in worldserver.conf? Search for chat.
According to commit history it has been loggable a long time. For example this commit from 6 years back seems to show that chat logging existed even back then and before it https://github.com/TrinityCore/TrinityCore/commit/97c4b92eb02fc673d1230aadaee23aa7827a9761

Link to comment
Share on other sites

I have looked at the loggers and appenders in the worldserver.conf but I can't seem to get them to work, following the TC documentation and from looking through the net. It's all tutorials and docs about how to log it to a file, not a database.

I can't see that it wouldn't be possible, just doesn't seem to be something that more people want. 

It seems definitely possible, I'm just trying to figure out how exactly.

Link to comment
Share on other sites

17 hours ago, jake said:

I have looked at the loggers and appenders in the worldserver.conf but I can't seem to get them to work, following the TC documentation and from looking through the net. It's all tutorials and docs about how to log it to a file, not a database.

The chat log log can easily log to the DB, Iv'e done it before with config changes. You have to enable the chat log as "debug" so it traps everything. Then set the Console to log to DB as well. It dumps to the Auth DB.

Example:

Appender.Console=1,3,0
Appender.Server=3,2,0,logs/default.log,w

#Logger.bg.reportpvpafk=3,Console Server
Logger.chat.log=2,Console Server
#Logger.calendar=3,Console Server

Example of the auth log:

| 1486524394 |     3 | chat.log.whisper   |     2 | Player Hammertime tells Hammertime: test                                                                                             |
| 1486524426 |     3 | chat.log.whisper   |     2 | Player Tyrone tells Hammertime: test                                                                                                 |
| 1486524433 |     3 | chat.log.whisper   |     2 | Player Hammertime tells Tyrone: whatup                                                                                               |
| 1486524453 |     3 | chat.log.whisper   |     2 | Player Tyrone tells Hammertime: not much                                                                                             |
| 1486556669 |     3 | server.loading     |     3 | >> No expired mails found.

 

 

Mind me asking why you want it to dump into mysql ?

Link to comment
Share on other sites

To be honest, Iv'e actually thought of setting up a repo diff (patch) for TC to log all chat into DB through a separate table.

If anyone wants traction on this, I can make it happen. Depending on the population the table may fill up extremely fast.

Link to comment
Share on other sites

I am logging to mysql with a custom script that uses OnChat, only for the normal system CHANNEL_FLAG_* channels.

I have cheesy perl scripts that read the messages and parse them, such as looking for "WTB" links and then the script may put an item in the AH and another that responds to LFG with calendar messages "LFG URBS" and the script looks up the calendar saying "URBS planned for 18:30 GMT 8/10 confirmed, PST for invite" (minus timezone / calendar glitches which I cannot figure out)

I agree that the table size gets crazy fast if you retain world chat, some partitioning is needed.

Link to comment
Share on other sites

  • 1 month later...
On 2/1/2018 at 12:56 AM, Ibeatdungeon said:

I am logging to mysql with a custom script that uses OnChat, only for the normal system CHANNEL_FLAG_* channels.

I have cheesy perl scripts that read the messages and parse them, such as looking for "WTB" links and then the script may put an item in the AH and another that responds to LFG with calendar messages "LFG URBS" and the script looks up the calendar saying "URBS planned for 18:30 GMT 8/10 confirmed, PST for invite" (minus timezone / calendar glitches which I cannot figure out)

I agree that the table size gets crazy fast if you retain world chat, some partitioning is needed.

This can probably be moved to Custom Code section - However, I actually was able to implement "in core" to log all chat to the database in a separate table under "characters". Let me know if you or anyone is interested, I can share the patch in github.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Jorgito
      Hello,
      I just discovered the loggings system, and after some test I saw that I can get log from gm by account ID, but is it possible to get chat log by account ID too? When I talk with my 2 acc separatly, the logs get in the same .log
       
      (Also in a second time, is there a way to change the timestap format for DD-MM-YYYY_HH_MM_SS instead of YYYY-MM-DD_HH_MM_SS ?)
       
      Thanks!
    • By rudi9719
      Hi! I wrote a python handler around the TrinityCore Worldserver to send messages to slack. However it seems like the only time commands are logged in the console output are if they're given by a GM. I modified the .a command so that any player can use it- however if a normal player uses it the message is not posted to the console's STDOUT which means it's not sent to my handler. Is there a way to log all commands? Not just GM commands? I tried uncommenting the Logger.commands.ra line in the worldserver.conf, but it didn't do anything noticeable yet.
×
×
  • Create New...