[ADMN]ConsoleFilter v0.5 - Blocks/Filters messages from your console & log file. [1.4.7-R1.0]

Discussion in 'Inactive/Unsupported Plugins' started by hmpf, Apr 4, 2011.

  1. Offline

    hmpf

    ConsoleFilter - Keep your server console and log file clean.

    Updated to work with CB-1.4.7-R1.0. Might work with lower/higher versions as well but I haven´t tested that.
    This is just a quick rework to work with the newest version.

    Issues:
    Sadly there are some drawbacks.
    Nowadays each plugin gets it´s dedicated logger developers should use. My plugin sets filters for all plugins that are or get registered in CB.

    Now to the problem: Developers are not forced to use the plugins default logger. They can just send their messages to custom created loggers. ConsoleFilter doesn´t know about these loggers and therefore wont filter them.
    Theoretically I can get all active loggers and put filters onto them. However this would mean that ALL loggers get filtered, be it from bukkit, a plugin, java, etc. As this is not the way it should be done I wont do it this way.
    This means that some console output will not be intercepted by ConsoleFilter and therefore wont get filtered.

    Installation (open)

    1. Copy the JAR file into your plugins-folder.
    2. Please remove BlockCantKeepUpSpam.jar and BlockConsoleMessages.jar if you're using any of them.
    3. Start the server.
    4. If no config file exists the plugin will create one under "./plugins/ConsoleFilter/".When creating a new config it will add the filter for the "Cant keep up!"-message.
    5. Stop the server and edit the configuration.

    How to use (open)

    1. Open the configuration file while your server is offline.
    2. Under "Filters:" add a new line and write the following:- FilterName: <FilterName>Replace <FilterName> with any name you want to give the filter.The whitespace between the minus and FilterName is important.
    3. Add your filter parameters. Each value needs to be preceeded by TWO whitespaces.Possible values:
      1. FilterType: Exact|Partial|Regex|Level
        1. Exact: Filters for the exact string given by ConsoleMessage.Requires option: ConsoleMessage.
        2. Partial: Searches for the partial string given by ConsoleMessage.Requires option: ConsoleMessage.
        3. Regex: Applies the regular expression defined in ConsoleMessage.Requires option: ConsoleMessage.If you mess up with these you can easily block all console output. ;-) (It wont harm your server though.)If you're interested in learning RegEx: http://en.wikipedia.org/wiki/Regular_expression
        4. Level: Filters on logging level basis. (e.g. Info, Warning, Severe, etc.)Requires option: ConsoleLevel.
      2. ConsoleLevel: Info|Warning|SevereOptional. This rule applies only to messages with the appropriate logging level.
      3. ConsoleMessage: <Message>Optional. String or regular expression to match. Replace <Message> with the string/regex of your choice.
      4. LogToFile: true|falseOptional. When set to true it will log the intercepted message to a seperate log file.
      5. LogfileSuffix: <Suffix>Optional. This way you can specify seperate logfiles for different rules. Replace <Suffix>with the suffix you want to give the log file.
    4. Save your configuration file.
    5. Start your server and (hopefully) enjoy your cleaned up console & log.

    Example for a configuration file (open)

    Code:
    ConfigVersion: 0.5
    Filters:
    - FilterName: Filter CantKeepUp Messages
      FilterType: Exact
      ConsoleLevel: Info
      ConsoleMessage: Can't keep up! Did the system time change, or is the server overloaded?
    - FilterName: Filter all Warnings
      FilterType: Level
      ConsoleLevel: Warning
      LogToFile: true
      LogfileSuffix: Warnings
    - FilterName: Filter lost connections
      FilterType: RegEx
      ConsoleMessage: '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:[0-9]{4,5} lost connection'
      LogToFile: true
      LogfileSuffix: LostConnections


    Download:
    http://dev.bukkit.org/server-mods/consolefilter/

    Older versions (open)

    Deprecated:
    BlockConsoleMessages - Blocks defined messages from appearing in your console and log file.
    Version: v0.3

    I've rewritten most of the plugins code to support the following new features:
    • Its now possible to specify saving filtered messages to a separate log file for each rule.
    • Its possible to set the log file name for each rule.
    • Its now possible to filter on a LogLevel-basis. (Filter all "Warning"-messages for example.)
    • Its possible to reload the configuration file while the server still runs.
    This required a new config file format though.

    Why beta?
    - I call it 0.3beta because I had not yet time to test it thoroughly.
    I haven't found any issues yet (otherwise I wouldn't release it) and all tests I did (exact matching, partial matching, regex matching, level matching) worked as intended but.. you never know.
    - Also the logic to automatically convert old config files to the new format is still missing.
    - Reloading the config file is NOT yet restricted to OPs only. So every user can do it ATM.

    How to use
    1. Backup & delete your old config file to create the new one or use the sample file down below.
    2. Under "Filters:" add a new line. Start it with a minus "-", followed by as many spaces as needed to be on the same level as the other values. This is important!
    3. The keys for rules are:
      1. FilterName: Unique Name[Required]This is the name of the rule. It will be used for displaying error messages and logging to separate files.
      2. FilterType: [Exact|Partial|RegEx|Level][Required] [Case Insensitive]Same as in v0.2. "Level" is new and means that the filter fires, when the log level is matched. So, if you set Level to ConsoleLevel: Info it will filter out every [Info]-message.You've been warned! ;-)
      3. ConsoleMessage: 'Custom String'[Optional] [Case Sensitive]The message that will be searched for. To be on the save side surround it with single quotes.
      4. ConsoleLevel: [Info,Warning,Severe,Fine,Finer,Finest][Optional] [Case Insensitive]The log level of the message this filter shall search for.You may also use your languages name for the level but its not required.e.g. if your running the server on a german OS you may type "Warnung" instead of "Warning".
      5. LogToFile: [true|false][Optional]If you set this to true each message filtered by this rule will get saved to a separate log file. By default the file name will be "server_BCM.log
      6. LogfileSuffix: ExampleString[Optional] To be on the safe side use only alphanumeric characters.Add a custom suffix for the log file.Example: If you set this to ExampleString and enabled saving to a separate log file it will save filtered messages to "server_BCM_ExampleString.log".
    0.3beta - Example config file
    Code:
    ConfigVersion: 0.3
    Filters:
    - FilterName: Filter CantKeepUp Messages
      FilterType: Exact
      ConsoleLevel: Info
      ConsoleMessage: Can't keep up! Did the system time change, or is the server overloaded?
    - FilterName: Filter all Warnings
      FilterType: Level
      ConsoleLevel: Warning
      LogToFile: true
      LogfileSuffix: Warnings
    - FilterName: Simple IP filter by using a regular expression
      FilterType: RegEx
      ConsoleMessage: '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
      LogToFile: true
      LogfileSuffix: IPs
    Download
    Plugin: http://dl.dropbox.com/u/1615073/Minecraft/Bukkit/BlockConsoleMessages/beta/BlockConsoleMessages.jar

    Deprecated:
    BlockConsoleMessages - Blocks defined messages from appearing in your console and log file.
    Version: v0.2

    Download:
    Plugin: http://dl.dropbox.com/u/1615073/Minecraft/Bukkit/BlockConsoleMessages.jar

    Installation
    1. Copy the JAR file into your plugins-folder.
    2. Please remove BlockCantKeepUpSpam.jar if you're using it.
    3. Start the server.If no config file exists the plugin will create one under "./plugins/BlockConsoleMessages/".When creating a new config it will add the filter for the "Cant keep up!"-message.
    4. Stop the server and edit the configuration.
    How to use
    1. Open the configuration file while your server is offline.
    2. Under "BlockThisMessages:" add a new line starting with a minus, followed by a space.(This is important!)
    3. Add your filter. There are three ways to do it:
      1. Exact match (case sensitive):Example: - ConsoleOutput or - EXACT::ConsoleOutputAdding "ConsoleOutput" will filter out every message that equals this string."xConsoleOutput", "Console Output", "ConSoleOutPut", etc. WON'T get filtered out.
    4. Partial match: (case sensitive)"Example: - PARTIAL::ConsoleOutputThis will filter out any message containing "ConsoleOutput".So "xConsoleOutput" will get filtered out. "Console Output", "xConSoleOutPut" wont.
    5. Regular expression (for advanced users):Example: - REGEX::version\ [1-9]\.[1-9]\.[1-9]This will filter out every message containing the string "version" followed by a space and 3 digits with a dot as the seperator.If you mess up with these you can easily block all console output. ;-) (It wont harm your server though.)If you're interested in learning RegEx: http://en.wikipedia.org/wiki/Regular_expression
    6. [Optional] If you want to log the filtered messages to an extra log file set LogFilteredMessages to true:LogFilteredMessages: trueThis wont log "Cant Keep Up!" messages as they are pretty useless.
    7. [Optional] If you want them logged nonetheless you may set LogCantKeepUpMessage to true:LogCantKeepUpMessage: trueIt will create a separate log file for just these messages.
    8. Start your server and (hopefully) enjoy your cleaned up console & log.
    Example configuration
    Code:
    BlockThisMessages:
    - Can't keep up! Did the system time change, or is the server overloaded?
    - ConsoleOutput
    - PARTIAL::ConsoleOutput
    - REGEX::version\ [1-9]\.[1-9]\.[1-9]
    LogFilteredMessages: false
    LogCantKeepUpMessage: false
    Possible issues
    • I haven't put much time in verifying if ALL plugin messages get send to the one central logger "Minecraft" but I guess its the only way for them to appear in the console. If a plugin uses its own logger it might not get caught by this filter.
    • Exact match and partial match seem to work just fine. I tested some regex matches and all worked but if you find a regex pattern that's not working please tell me!
    • Please add your regex and the matching part of your servers log to your post.
    • I'm new to java & bukkit development so the source might not be optimal written.
    I tested the plugin with CraftBukkit 621 but as it is only scanning the console output it should run with any version I guess.


    Changelog:
    Version 0.5
    • Changed name to ConsoleFilter.
    • Updated to be usable by CB 1.4.7-R1.0
    • Console output of later enabled plugins gets filtered as well.
    Older changes (open)

    Version 0.3
    • Added the possibility to filter on LogLevel-basis.
    • Logging filtered messages may now be activated for each rule separately.
    • The separate log file name may now be specified for each rule separately.
    Version 0.2
    • Added the possibility to log filtered messages to a seperate log file.Read the "How to use"-section.
    Version 0.1
    • First release
     
    Mhalkyer and WolwX like this.
  2. Offline

    NeoZeroo

    This is awesome! It's working well, but should/can it block messages from appearing ingame too? Like those:
    CONSOLE: Forcing save..
    CONSOLE: Save complete.
    CONSOLE: Disabling level saving..
    CONSOLE: Enabling level saving..

    They get blocked at the server.log, but they show at the ingame chat if you are an OP.

    Also, you should clean those ":p" from your tutorial, it got me confused to think it was supposed to be a single ":", and not "::", could confuse other too. Oh, and it's working on linux here!

    Thanks for the nice plugin!
     
  3. Offline

    beecub

    Worked on a console filter yesterday...
    Now i dont have to write it myself. Iam using this :)
     
  4. Offline

    DDMoose

    Thank you thank you THANK YOU!!!! :D I wanted to be able to keep the update frequency of one of my plugins low but it was causing MASSIVE log files of the same lines over and over to have to sift throw when trying to find stuff. This has cleaned my log file up to a much more readable state when I get back to check for any errors.

    Running on Windows 7 w/ CB 612
     
  5. Offline

    hmpf

    Sadly, at the moment there does not seem to be a way to catch chat output that gets sent to the game client via the console or plugins. Hopefully the developers will add this to bukkit in the future.

    Or I am missing something in the bukkit API. I asked in the developer forum, maybe someone knows of a way I missed.

    Hah, and I worked on a plugin to log player chat to an extra log file. Now Ill try out bLog. :)

    I updated it to 0.2.
    Its now possible to log the filtered out messages to a separate log file.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  6. Offline

    CorneliousJD

    Since it's relevant to THIS plugin and not your other one I guess I'll post it here...

    I'm getting this at the console.

    And here's my config

     
  7. Offline

    hmpf

    I don't use any kind of HTTP- or Network-Client.

    Was my plugin the only change you did to your server or did you update other plugins as well?

    My guess is the errors come from from another plugin: BukkitUp.
    There are several exceptions thrown by it:
    2011-04-05 10:15:57 [SEVERE] at ws.triii.bukkitup.BukkitUp.getCurrentBuildNumber(BukkitUp.java:40)
    2011-04-05 10:15:57 [SEVERE] at ws.triii.bukkitup.BukkitUp.<init>(BukkitUp.java:29)
    2011-04-05 10:15:57 [SEVERE] at ws.triii.bukkitup.PluginMain.onEnable(PluginMain.java:28)
     
  8. Offline

    CorneliousJD

    My apologies, your right, its something wonky with BukkitUp right now, removed it for the time being and it seems to be working fine now thanks!
     
  9. Offline

    MineralMC

    How do I go about using this to hide all [INFO] messages in the console, while still logging them? I only really want to see [WARNING] and [SEVERE] messages from plugins.
     
  10. Offline

    hmpf

    That's not yet possible as the plugin only filters the message, not the level of the messages.
    I'll add that in 0.3. Cant give any ETA though.
     
  11. Offline

    CorneliousJD

    This isn't working as expected right now for some reason?

    And I'm still getting the following line...

    CB617
     
  12. Offline

    hmpf

    My fault, of course IPs can contain zeros:
    - REGEX::[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:[0-9]{4,5} lost connection
     
  13. Offline

    CorneliousJD

    OHHHHHHHHHHHH, makes perfect sense why they were only showing up SOMESTIMES (turns out whenever the port contains zeros.

    Me and a coworker looked over the regex today countless times to try to find out what was wrong but it looked solid.

    BTW, Does the REGEX need to start with the / that's in front of the IP or no?
     
  14. Offline

    hmpf

    It doesn't need it, but it's safe to add it. The more specific you are the better to prevent filtering out the wrong things.
     
  15. Offline

    JonnoXD

    hey, im sorry if this isnt really relevant to this, but how can i stop the bukkit server from telling me every time someone places stone or tnt? its really getting on my nerves. help please! ive tried to use this plugin, but its not working presumably because its the wrong aspect of the server. any tips? ):
     
  16. Offline

    hmpf

    Can you give me examples of the messages you get?
     
  17. Offline

    WolwX

    I like it :D

    But can you allow différente separate log file ?

    I mean perhaps with your plugin I can filter SEVERE error to a server.log, then all my CHAT message to a chat.log ...

    That's can be usefull :D
     
  18. Offline

    Carbon131

    This is brilliant, I can get rid of some serious console spam now, thanks!
     
  19. Offline

    hmpf

    That's my plan for the next version. No ETA though. :(

    I've added the 0.3beta to the first post.

    This is possible in 0.3. As far as I know it's still not possible to process chat output, but you may filter [Warning], [Severe], etc. into separate log files.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  20. Offline

    WolwX

    I will test :D

    That's can work with my actual Chat plugin (HeroChat), that's create a log easy to filter so I will give feedback here if that's work for me :)
     
  21. Offline

    hmpf

    Just want to let everyone interested in this plugin know that Ill finish the work on 0.3 in the near future.
    But I'm on vacation next week so its probably going to be the week after that.
     
  22. Offline

    Plague

    Don't use a plus sign in the version tag. If you really need to use more versions, use [X-Y] or [X,Y].
     
  23. Offline

    Plague

    inactive then
     
  24. Offline

    Mhalkyer

    Please don't be inactive! !_!

    I really wanna figure out how to remove color codes (like §9) so I can read my log easier.
     
  25. Offline

    Chosen

    need update pls :)
     
  26. Offline

    Allio567

    I love the idea of the plugin! But, could you please update it for 818? Or just wait for the 1.7 build? Thanks!
     
  27. Offline

    Wolfy9247

    For the love of god, pleaseeeeee, update! (Anyone for that matter... I </3 spam in my console)
     
  28. Offline

    Mhalkyer

    Is there any way to block or replace the color codes from the server console output?

    Example:

    Change this:
    [§5Fluffy§f] §f§9Sentinull§7:§f so uh...

    To this:
    [Fluffy] Sentinull: so uh...
     
  29. Offline

    Boos

    How i can filter chat messages?
    Code:
    - FilterName: Chat
      FilterType: RegEx
      ConsoleMessage: '[A-Za-z0-9_\[\]]{1,30}\:[ \t]'
      LogToFile: true
      LogfileSuffix: chat
    Is not working...
     
  30. Offline

    TechJawa

    This still works on Minecraft 1.0!!! Using the non-beta version to block a server-online check and the can't keep up messages. Thanks!
     

Share This Page