07-29-2015
Search string or words in logs without using Grep
I'm in need of some kind of script that will search for a string in each logfile in a directory but we don't want to use GREP. GREP seems to use up to much of our memory causing the server to use up a lot of swap space. Our log files are bigger than 500M on a daily basis. We lately started turning over our logs when it reaches 1G to help but it seems to still use up a lot of our memory causing the server to use up too much of its swap space.
Any recommendation on how we can search for strings/words in each logfile thats within a directory without having to use grep?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
Please help me in the following dbt
i want to know the different files in the current and the sub directory which have some search key in that . for example
i want to know all filenames followed by the word 'unix' in all files.
the file name and the matching word have... (1 Reply)
Discussion started by: akhil313
1 Replies
2. UNIX for Dummies Questions & Answers
Hi frnds
i want to desplay file names that should be word1 and word2
ex :
i have 10 *.log files
5 files having word1 and word2
5 files having only word1,
i have used below command
egrep -l 'word1|word2' *.log
its giving all 10 files, but i want to display only 5... (20 Replies)
Discussion started by: pb18798
20 Replies
3. Shell Programming and Scripting
Hi,
I am trying to grep a particular string from the files of 2 different servers without copying and calculate the total count of its occurence on both files.
File structure is same on both servers and for reference as follows:
27-Aug-2010... (4 Replies)
Discussion started by: poweroflinux
4 Replies
4. Shell Programming and Scripting
I have requirement to prepare script which will grep for latest outofmemory message from the logs. I have used following command to grep the string from the logs,this script is not effective when logs are not getting updated as it will grep for old message.
f=catalina.out
var=`tail -10 $f |... (17 Replies)
Discussion started by: coolguyamy
17 Replies
5. Shell Programming and Scripting
Hi,
Need your help for this scripting issue I have. I am not really good at this, so seeking your help.
I have a file looking similar to this:
Hello, i am human and name=ABCD.
How are you?
Hello, i am human and name=PQRS.
I am good.
Hello, i am human and name=ABCD.
Good bye.
Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies
6. Shell Programming and Scripting
Hi Folks,
I have a log file at the following location..
/opt/ert/abc.log
Now abc.log contain the following enteries in this format below..
23-Jul-2014 10:09.32.204 ERROR abc.log cdfrer tyre fgty >>>>> cqno : 78539132 abc Id : 0 Sabc : 20140724
Now in log file (abc.log) I want to... (2 Replies)
Discussion started by: tuntun343466
2 Replies
7. Shell Programming and Scripting
Hello,
What I wish to attain is:
- to read fileA line by line
- search entire line as string in fileB
- when found, grep the next line in fileB
- then merge "searched line" and "found line" in a new file, fileC
Here is my fileA:
T S Eliot
J L Borges
L Aragon
L L Aragon
T S Eliot 4 0... (17 Replies)
Discussion started by: baris35
17 Replies
8. Shell Programming and Scripting
Hello,
I have two files. All urls are space seperated.
source
http://xx.yy.zz http://df.ss.sd.xz http://09.09.090.01
http://11.22.33 http://canada.xx.yy http://01.02.03.04
http://33.44.55 http://98.87.76.65 http://russia.xx.zz
http://aa.tt.xx.zz http://1w.2e.3r.4t http://china.rr.tt
... (4 Replies)
Discussion started by: baris35
4 Replies
9. UNIX for Beginners Questions & Answers
Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried:
grep -lr "this string" *
but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies
10. UNIX for Beginners Questions & Answers
I have multiple strings in a file which have special character $, when i search strings by ignoring $ with \ using single quotes it returns empty results.
My search strings are set char_1($lock) and set new_char_clear_3($unlock)
I tried searching with
but it returns empty results.However... (3 Replies)
Discussion started by: g_eashwar
3 Replies