06-01-2009
How to keep appending a newly created file based on some keywords
Hi Friends,
I have to create a new log file everyday and append it with content based on some keywords found in another log file.
Here is what I have tried so far...
grep Error /parentfolder/someLogFile.log >> /parentfolder
/Archive/"testlogfile_error_`date '+%d%m%y'`.txt"
grep error /parentfolder/someLogFile.log >> /parentfolder
/Archive/"testlogfile_error_`date '+%d%m%y'`.txt"
grep Failed /parentfolder/someLogFile.log >> /parentfolder
/Archive/"testlogfile_error_`date '+%d%m%y'`.txt"
grep failed /parentfolder/someLogFile.log >> /parentfolder
/Archive/"testlogfile_error_`date '+%d%m%y'`.txt"
Following are the instructions that I must follow:
1. Log file should either gte created in Archive folder or should get created in parentfolder and then moved to Archive.
2. Newly created log file should have date appended to its name.(I have taken care of this).
3. This file should get appended whenever there is an Error, error, Failed or failed keyword is found in "someLogFile.log" file.
The issue I am facing are
1. The new log file either do not get created properly or if created it does not get appended by the content of next found words.
2. Even if i am able to create the file it does not open at all, untill I use a touch command to create a new file and append it with first keyword.
I am not looking for complete code but if I am making any mistakes in my approch then any correction required is appriciated.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
An application running on HP-UX constantly generates new text log files ( I think using logpipe ). Any new file created requires to be ftp'ed to an offline server, however I want to make sure that the current file being written should not be transferred.
For examples consider the following files... (3 Replies)
Discussion started by: indianya
3 Replies
2. Shell Programming and Scripting
Hi,
I need to create new directory by increasing the number by 1 of extracted lastly created directory.
e.g.
Log\out_log_1\
Log\out_log_2\
Log\out_log_3\
become
Log\out_log_1\
Log\out_log_2\
Log\out_log_3\
Log\out_log_4\
Can anyone help how to do it in c-shell... (3 Replies)
Discussion started by: Andre_2008
3 Replies
3. Shell Programming and Scripting
Hi,
We have a sftp server which creates files daily and keeps 6 months of files on the server. We are creating a daily job to get the files and load into database. My problem is "how to get ONLY those files which got created after my last get". Let me provide some more details to it.
Below... (15 Replies)
Discussion started by: ravi.videla
15 Replies
4. UNIX for Advanced & Expert Users
Hi all,
In linux how to create a directory with specified size, so that it can be used only up to the mentioned size.
Actually my question is, whether we can do directory quota in linux.
mounting the directory in a partiton will do that, but do we have any other option... (1 Reply)
Discussion started by: anishkumarv
1 Replies
5. Shell Programming and Scripting
Hi Guys,
I have the following problem. I have original file (org.txt) that looks like this
module v_1(.....)
//arbitrary number of text lines
endmodule
module v_2(....)
//arbitrary number of text lines
endmodule
module v_3(...)
//arbitrary number of text lines
endmodule
module... (6 Replies)
Discussion started by: kaaliakahn
6 Replies
6. Solaris
hello,
i am an oracle DBA and trying to scan a newly created LUN of 200 GB on fiber channel by SAN admin.we have solaris 10 and SANtoolkit is installed.i tried following to get the new LUN at my machine. go /opt/Netapp/Santoolkit/bin and then ./sanlun lun show but i see only the existing... (12 Replies)
Discussion started by: janakors
12 Replies
7. Shell Programming and Scripting
hello everyone,
I am new to perl script and trying to develop a script as follows.
I am trying to Create an array for storing all file names. I am trying to copy $libs into "scratch". however i am unable to do so. Please suggest..
#!/usr/bin/perl
use File::Copy;
#use... (5 Replies)
Discussion started by: Rashid Khan
5 Replies
8. Hardware
Hi ,
I have created one new lun in my SAN storage and make it visible to my HP servers , but the fdisk -l output is somehow confusing. Do not know what to do next ----------
fdisk -l /dev/sdo1
Disk /dev/sdo1 (Sun disk label): 64 heads, 32 sectors, 10238 cylinders
Units =... (7 Replies)
Discussion started by: mishra.sankar
7 Replies
9. AIX
AIX 7.1
New to WPAR, hopefully just missing something simple here.
Creating the WPAR like this.....
(The box where the WPAR is hosted does have an iscsi protocol device)
mkwpar -h wpar08 -l -n wpar08 -N interface=en0 address=xxx.xx.xx.xxx netmask=255.255.255.0 -D devname=/dev/iscsi0 -D... (0 Replies)
Discussion started by: TomR
0 Replies
10. UNIX for Beginners Questions & Answers
Hello guys
thanks for this helpful forum.
I'm new to scripting and doing a little script that dump a sql database with some extra files from a VM of the company I'm in, and create a tar archive to be saved on our serve.
How can I have the tarball to be created with the files generated in the... (2 Replies)
Discussion started by: dquake
2 Replies
LEARN ABOUT REDHAT
newslog
NEWSLOG(5) File Formats Manual NEWSLOG(5)
NAME
newslog - description of Usenet log files
DESCRIPTION
Most log files created by Usenet programs reside in the <pathlog in inn.conf> directory and have a ``.log'' extension. Several versions
are usually kept with an additional extension such as ``.1'', ``.2'', etc. -- the higher the number, the older the log. The older versions
are compressed.
The scanlogs script and related utilities (see newslog(8)) are responsible for rotating and compressing these files.
Some log files always have data, others only have data if there is a problem, and others are only created if a particular program is used
or configuration parameter is set. The innstat script (see newslog(8)) monitors the size of all log files.
The following files will only accumulate data under the direction of control.ctl(5):
control.log miscctl.log newgroup.log rmgroup.log unwanted.log
In order to create these files, the ``message'' and ``action'' fields of control.ctl should be chosen from the following table:
Message Action Meaning
all log=miscctl Log all messages by default
default log=miscctl Log unknown messages
newgroup doit=newgroup Create group and log message
newgroup log=newgroup Log message
rmgroup doit=rmgroup Remove group and log message
rmgroup log=rmgroup Log message
``other'' doit=miscctl log and process the message
``other'' log=miscctl Log message
Here, ``other'' refers to any other control message such as:
checkgroups ihave sendme sendsys senduuname version
The following is a list of log files.
control.log
This file maintains a count of the number of newgroup and rmgroup control messages seen for each newsgroup. The count is of the
number of control messages with identical arguments, regardless if they were actually processed. All control arguments, including
invalid ones, are counted. This file is updated by tally.control, which is invoked by scanlogs if either the newgroup or rmgroup
logs exist. This file is not rotated.
errlog This file contains the standard output and standard error of any program spawned by innd(8). The most common programs are the con-
trol-message handlers found in <pathcontrol in inn.conf>. This file should be empty. Scanlogs will print the entire contents of
this log file if it is non-empty.
expire.log
By default, when news.daily is going to expire old news articles, it writes the date to this file, followed by any output from
expire(8) and the ending date. All lines but the first are indented four spaces.
miscctl.log
When control.ctl is configured as described above, all control messages except newgroup and rmgroup are appended to this file by
writelog. There will be a summary line describing the message and the action taken, followed by the article indented by four spa-
ces, and a blank line.
newgroup.log
When control.ctl is configured as described above, all newgroup messages are appended to this file using the same format as for mis-
cctl.log.
news This file logs articles received by innd. Scanlogs summarizes the rejected articles reported in this file.
news.crit
All critical error messages issued by innd are appended to this file via syslog(3). This log file should be empty. Scanlogs will
print the entire contents of this log file if it is non-empty. You should have the following line in your syslog.conf(5) file. (A
typical entry is shown; it should agree with <pathlog in inn.conf>)
news.crit <pathlog in inn.conf>/news.crit
news.err
All major error messages issued by innd are appended to this file via syslog(3). This log file should be empty. Scanlogs will
print the entire contents of this log file if it is non-empty. You should have the following line in your syslog.conf(5) file: (A
typical entry is shown; it should agree with <pathlog in inn.conf>)
news.err <pathlog in inn.conf>/news.err
news.notice
All standard error messages and status messages issued by innd are appended to this file via syslog(3). Scanlogs uses the perl(1)
script innreport(8) to summarize this file. You should have the following line in your syslog.conf(5) file: (A typical entry is
shown; it should agree with <pathlog in inn.conf>)
news.notice <pathlog in inn.conf>/news.notice
nntpsend.log
The nntpsend(8) programs appends all status messages to this file.
rmgroup.log
When control.ctl is configured as described above, all rmgroup messages are appended to this file using the same format as for misc-
ctl.log.
unwanted.log
This log maintains a count of the number of articles that were rejected because they were posted to newsgroups that do not exist at
the local site. This file is updated by tally.unwanted and maintained in reverse numeric order (the most popular rejected group
first). This file is not rotated.
HISTORY
Written by Landon Curt Noll <chongo@toad.com> and Rich $alz <rsalz@uunet.uu.net> for InterNetNews. This is revision 1.6.6.1, dated
2000/08/17.
SEE ALSO
control.ctl(5), ctlinnd(8), expire(8), inn.conf(5), innd(8), news.daily(8), nntpsend(8), newslog(8).
NEWSLOG(5)