EssentialsX

EssentialsX

2M Downloads

Request: Essentials Eco Log to MySQL database

TomLewis opened this issue ยท 16 comments

commented

Hey guys, absolutely stellar work your doing for keeping essentials going! Ive used Essentials since day 1 of running a server many years ago, 1 of the biggest annoyances I have come across is the absence if MySQL support, Not for users data, For logging! Trying to diagnose and search through my 50MB trade log is absolutely painful, we have tried parsing the text file with PHP, but the files just too big and it grows and grows, its not searchable or anything.
Please give us the Option to save Essentials Eco trade logs to MySQL, I could crack out a Web UI in an hour to have a fully searchable web UI for all Essentials economy.

There must be a reusable MySQL class pre-made out there ready to put into your project, then where you write to the trade.log replace this with writing to the database instead.

commented

Any update on this?

commented

Please make this happen

commented

I've been wanting to do what I said in #28 where we just make a new log file on each restart. Would be so much easier. Though MySQL would be a pretty easy alternative.

commented

Both! MySQL gives us many more options, having a web ui to view all economy
transactions would be a big improvement, I'll throw up whatever I make onto
github too. Would be good to figure out if there's an eco issue by flagging
large transactions on the web ui, you could build all sorts of stats with a
mysql log!

On Wed, 26 Aug 2015 21:22 Trent Hensler [email protected] wrote:

I've been wanting to do what I said in #28
#28 where we just make a
new log file on each restart. Would be so much easier. Though MySQL would
be a pretty easy alternative.

โ€”
Reply to this email directly or view it on GitHub
#167 (comment)
.

commented

@drtshock Any chance this could still happen? Im looking at an economy update just because managing a trade.log that is now 250mb in size is impossible, A proper database is needed to log this information! There's a lot of tutorials on how to implement MySQL into plugins available if that is the issue? We have passed a year now since I posted this ticket!

commented

Can I get this reopened please? This was requested in 2015, its now 2018. My trade log is now... 101mb, I want to keep the data as at some point I plan on making a web UI as soon as its possible to track all trade log data into mysql. Thank you.

commented

This was never closed.

There's nothing stopping you from writing a web UI that parses the existing trade log file and converting it to a different format to be accessed by a HTTP request from a web page.

commented

I already did that, parsing a 101mb CSV file isn't the best way to do this, let alone store the data, there are plenty of MySQL library's out there, all it would be is importing one, and the wherever it saves to the trade log file have it also insert a row into the database.

commented

I don't see logging as a valid reason to maintain a connection to a MySQL server within EssentialsX, when there are already many, many ways to make use of the existing trade log. I also don't see that we're going to add another dependency just for this purpose.

You could also manually parse the existing log and insert the entries into a table, and you could monitor the file for new entries (tail -f for example) and add them to a table. That way, your whole trade log is then in a MySQL database.

commented

Does the ess trade log support log4j? If so, https://www.tutorialspoint.com/log4j/log4j_logging_database.htm

Maybe that's our solution.

commented

That log4j looks like its a winner, I have no idea how to use it mind you.

commented

So if we use(d) it for the trade.log, it means that you could configure some stuff about how the logging works. Log4j goes as far as to let you put the logs into a sql database. It's how the normal mc server logs know when to split logs, put the timestamp, etc.

You'd just need to configure the .xml file related to the trade.log with w/e the mysql info is and you'd be good to go. We could even provide a default config for that since I imagine this could be a pretty useful feature for a lot of servers that probably WOULD log if they could have it in sql. The only issue here is that it would likely just enter the entire line of the log as a single string instead of having columns for players, amounts, etc.

commented

I'm pretty sure the log is as simple as just appending a line to a file. Log4j is massively overkill for this, as is adding any dependency solely for this purpose.

There's many, many ways to watch the trade log file for changes and process new lines, and there's no use bloating EssentialsX with this when it shouldn't even need to happen on the server's JVM at all.

commented

That's a good idea! So import them all first, and then monitor for changes of the file and just add those so I'm not having to import the entire file each time, is that right? I haven't used tail -f before, but from a quick look it seems as if it keeps an open connection, so it would have to run in its own tmux to keep tracking? This may be a bit extreme just to get a log into MySQL.

commented

You don't have to run it in tmux specifically, but it's one example of a shell command that you could use to monitor files. A simple shell script is probably the least extreme way to automatically copy the trade log to a database.

commented

Yeah I have to agree with md in that this has such a limited use, and there is really no reason for adding MySQL support to Essentials as is (unless it is done plugin-wide, not just for trade logging). I'm going to close this issue as being too much of a niche request. A more general issue should probably be opened for discussing inclusion of MySQL or Log4J features incorporated into the plugin.