Hi everyone,
I've been wracking my brain on this problem so any help is greatly appreciated.
The problem I am having is regarding reading in a text file for parsing. I have created a script to open and parse several thousand log files. Of those thousands roughly 90 percent will open and parse just fine the other ten percent give me the following error:
Error! File: '/audit/logs/computer1.log' had the following error: No such file or directory
Heres the code that is generating that.
now the output from $! indicates the file or directory cannot be found but I have checked and rechecked the path, file names, and permissions and am absolutely positive that they are all correct. Keep in mind this error is only showing up on a relatively minor number of log files, the rest work fine.
It may be helpful to know that these log files are audits generated on windows boxes by secaudit. They are then dumped onto a samba share(on a redhat entrprise box running perl 5.8.5) where the perl script parses them and outputs pertinent info into a mySQL database.
I would greatly appreciate any suggestions on either correcting this code or other ways to read in those files.
Thanks,
Dustin
I've been wracking my brain on this problem so any help is greatly appreciated.
The problem I am having is regarding reading in a text file for parsing. I have created a script to open and parse several thousand log files. Of those thousands roughly 90 percent will open and parse just fine the other ten percent give me the following error:
Error! File: '/audit/logs/computer1.log' had the following error: No such file or directory
Heres the code that is generating that.
Code:
open (LOGFILE, "'$LogPath/$DefaultLog'") or $Check=1 and my $ErrVar1=$!;
if ($Check == 1) {
$SQL="INSERT INTO errLog (errFile, errDesc) VALUES ('$LogPath/$DefaultLog','$ErrVar1')";
&Do_SQL;
print "Error! File: '$LogPath/$DefaultLog' had the following error: $ErrVar1 \n";
}
now the output from $! indicates the file or directory cannot be found but I have checked and rechecked the path, file names, and permissions and am absolutely positive that they are all correct. Keep in mind this error is only showing up on a relatively minor number of log files, the rest work fine.
It may be helpful to know that these log files are audits generated on windows boxes by secaudit. They are then dumped onto a samba share(on a redhat entrprise box running perl 5.8.5) where the perl script parses them and outputs pertinent info into a mySQL database.
I would greatly appreciate any suggestions on either correcting this code or other ways to read in those files.
Thanks,
Dustin