What I need is to monitor the last line of a file (more specificly the latest.log
file for a Minecraft server) and test to see if it contains any predetermined strings.
Example:
I want to see when a specific player says a certain string. When the player says the specific string the last line of the latest.log
will look like this:
[12:34:56] [Server thread/INFO]: <minecraft_player> string_i_need
When minecraft_player
says string_i_need
I need it to trigger other things but I think I know how to do that I just need to know how to isolate the key elements as variables.
What I want to isolate as variables:
$TIME = [12:34:56]
$NAME = minecraft_player
$STRING = string_i_need
I also need to make sure I don't detect a "false positive" if a malicious player were to say [12:34:56] [Server thread/INFO]: <minecraft_player> string_i_need
causeing the last line of the latest.log file to look like:
[12:34:56] [Server thread/INFO]: <malicios_player> [12:34:56] [Server thread/INFO]: <minecraft_player> string_i_need