Solved Log Minecraft server.log to MySQL instead of file

Discussion in 'Bukkit Help' started by Tylerjd, Jul 1, 2013.

Thread Status:
Not open for further replies.
  1. Offline


    Hey all,

    It has been a while since I have posted here, and after a bit of Google searching, I have been stumped on how to figure this out. I was wondering if there was a way to log the outbound server output (normally placed in server.log) to a MySQL DB, instead of the flat file, with each entry being on a separate line. I am running a set of servers on some Debian and Ubuntu boxes (so maybe a tool in apt instead of a plugin? either works for me), and would like more localized log management, and the possibility to build on it.

    Most simply, I would like it to log the line you would normally see in the server.log to the DB, however, if there is a way to separate, say, the severity, time, etc into separate columns (so I can run queries on it with WHERE, and such), that would also be fantastic.

    I may have just possibly Google'd using the wrong fu, but any help would be greatly appreciated.
  2. Offline


  3. Offline


    Sorry for the late response, but it seems like the script has disappeared into the void. I will keep looking, but thanks!
  4. Offline


    If you want to insert log into MySQL, not sure about "severity" but.

    2. <?php
    3. $path = "/usr/root/server.log";
    4. //Make sure you set openbase_dir to /
    5. $handle = fopen($path, 'r');
    6. While(!feof($handle)){
    7. $data = fgets($handle);
    8. $query = "INSERT INTO blah rest of query value as '".$data."'";
    9. Mysqli_query($query);
    10. }
    Tylerjd likes this.
  5. Offline


    That is basically what I was looking for, at least to jump start the project. Thanks!
  6. Offline


    You can actually save that as a different file and add some jQuery

    And it will run insertlog.php every 100ms
    Tylerjd likes this.
Thread Status:
Not open for further replies.

Share This Page