[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

    hmpf

Share This Page