Viewing updates of a dynamically generated log on a remote linux server from a windows machine
You can try klogg. It is a fork of glogg. Glogg opens files in such a way that may prevent other programs from accessing them, that is described here. That has been fixed in klogg(see the issue for details).
How can I view log files in Linux and apply custom filters while viewing?
Try the multitail tool - as well as letting you view multile logs at once, I'm pretty sure it lets you apply regex filters interactively.
How to read a dynamically changing file
the way i think i would go about it is this:
first of all i will create a bash script and a text file, the bash script will first store the number of lines of that log file in the text file, then add a cron of that script.
the script will count the lines of that file and compare it to the number of lines stored in the text file
you can do that using the command
wc -l filename
if the number of lines is bigger then the log has been updated, i will calculate the current number of lines minus the number stored in the text field, and by that i will know how many lines have been added since last check, then use this command to fetch those lines
tail -n $number_of_lines filename
and i will loop through the output and do the desired action if one of the lines matches your criteria and then update the text file which holds the number of lines, i would have written you the bash script but i guess you got the idea
EDIT: you can execute this script (just write your code which searches for the matches etc)
#!/bin/bash
NUMBER=`/bin/cat ./numberoflines`
LINES=`/usr/bin/wc -l < /var/log/messages`
DIFFERENCE=$(($LINES-$NUMBER))
if [ $DIFFERENCE != 0 ]; then
tail -n $DIFFERENCE /var/log/messages |while read line
do
if $( echo $line | grep --quiet 'New USB device found' )
then
# Email text/message
EMAIL='youremail@gmail.com'
SUBJECT="New USB device found"
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "New USB device found etc ..." > $EMAILMESSAGE
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
fi
done
echo "$LINES" > ./numberoflines
fi
EVEN if you cannot add anything to crons then you still can execute this script anyway, see what you want to match and check and execute the code you need there
Related Topics
Detecting a Chroot Jail from Within
How to Change the Monitor Brightness on Linux
How to Use Linux 'Perf' Tool to Generate "Off-Cpu" Profile
Using Linux, How to Specify Which Ethernet Interface Data Is Transmitted On
Subtract Days from a Date in Bash
Opening a .Tar.Gz File with a Single Command
How to Find the Processor/Chip Architecture on Linux
How to Automate the Installation of Eclipse Plugins with Command Line
How to Export Database Schema in Oracle to a Dump File
How to Divide in the Linux Console
Genymotion Throws Libssl_Conf.So: Cannot Open Shared Object File: No Such File or Directory
Can't Remove a Directory in Unix
How to Change(Hide) the Nginx Server Signature
What Is the Pid in the Host, of a Process Running Inside a Docker Container
Ssh Error When Executing a Remote Command: "Stdin: Is Not a Tty"
Isolate Kernel Module to a Specific Core Using Cpuset
What's the Difference of Redirect an Output Using ">", "&>", ">&" and "2&>"