Monitoring log file for entries - Find command & sorting
hi,
I would like to monitor a log file, which rolls over, everytime a server is restarted.
I would like to grep for a string, and to be more efficient i'd like to grep only newly appended data. so something like a 'tail -f' would do, however, as the log rolls over i think a 'tail -F' is what i need, but this doesn't seem to be available in Solaris.
so any ideas welcome. the log file/s is named:
"test*.txt"
the string i'm looking for is "error_message_here"
so i was going to do something like this:
or should i use the find command, however, how would i then cat out the message.
so far i have:
output is this:
-rw-r--r-- 1 hrid hrinkp 601456524 Aug 22 09:06 ./test1.txt
so i find the files by name, then list/sort them with ls -lr, i then get the top entry (filename).......and that is the file that i'd like to grep/cat for the message.
how would i do that now? because i've used ls -l, its in long format, so i need to specify the coloumn which is the filename (./test1.txt) that I would like to search i.e.
The first line puts a list of all test*txt files in reverse order into $1, $2, ... Note: you don't have to use -l, when you want files to be sorted in reverse order.
Now $1 holds the name of the file you want to grep. Now do it:
that seems to be all
ENVIROMENT
Linux: RHEL 6.4
Log Path: /usr/iplanet/servers/https-company/logs
Log Format: user.log.03-15-2015
I have log4j log rotation enabled rotating files on a daily basis.
The rotated logs are NOT compressed & are taking up too much space.
I need a script that will run daily that... (1 Reply)
I need assistance with following requirement, I am new to Unix.
I want to do the following task but stuck with file creation date(sysdate)
Following is the requirement
I need to create a script that will read the abc/xyz/klm folder and look for *.err files for that day’s date and then send an... (4 Replies)
NB! I have already started a thread on this subject on ComputerHope (with the thread title "Recursive File Renaming & Logical Sorting"). However, on ComputerHope they are perhaps more specialized in Windows Command Prompt, and not that much in shell scripts for Bash (I guess).
I have a bulk... (1 Reply)
Hi all !
I have a fasta file that looks like that:
>Sequence1
RTYIPLCASQHKLCPITFLAVK
(it's just an example, obviously in reality I have several pairs of lines like that)
Using UNIX command(s), would it be possible to replace all the characters except the "C" of the second line only by... (7 Replies)
Hi all ,
I'm new to unix
I have a checked project , there exists a file called xxx.config .
now my task is to find all the files in the checked out project which references to this xxx.config file.
how do i use grep or find command . (2 Replies)
I'm sorting files from a source directory by size into 4 categories then copying them into 4 corresponding folders, just wondering if there's a faster/better/more_elegant way to do this:
find /home/user/sourcefiles -type f -size -400000k -exec /bin/cp -uv {} /home/user/medfiles/ \;
find... (0 Replies)
I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves.
Also, the script should only move a file from /exports to... (6 Replies)
i need help with my script....
i am suppose to grab files within a certain date range
now i have done that already using the touch and find command (found them in other threads)
touch -d "$date_start" ./tmp1
touch -d "$date_end" ./tmp2
find "$data_location" -maxdepth 1 -newer ./tmp1 !... (6 Replies)
Hi
..first post !
I have a Unix v445 using solaris 10. I've trolled through various web pages but can't find exactly what I'm looking for.
I have an alert log...or any messages file for that matter I need to check for certain key (error type) phrases - if I find them, they are redirected to... (11 Replies)