logsearch.sh localhost /var/tmp/logXray autonda /var/log 60m 'fatal_P_error_P_critical_P_failure_P_warning' '. Solution to the Original Poster's Issue: Scan for Multiple strings in multiple log files. logsearch.sh localhost /var/tmp/logXray autonda /var/log/messages 60m 'can.*t.*open_P_ntpd.*stat' '.' 1 2 blahblahA -ndfoundmul When using '-ndfoundmul', you'll get an output similar to. ![]() If you just want to see the total count of each pattern found, simply replace '-ndshow' with '-ndfoundmul'. The log option -ndshow - This is the parameter you want to use if you wish to output the entries from the logs found matching the pattern(s) you specified. ![]() And for the line number you should use the -n option. ![]() Grep does not know how to expand the pattern - it just tries to find files named literally. Since the current directory doesnt contain any files matching the pattern, the patten literal is passed to grep. It records stats about the log file(s) you're monitoring under /var/tmp/logXray You can use the following option of grep: -includeGLOB Search only files whose base name matches GLOB (using wildcard matching as described under -exclude). mk happens in the shell, not in grep, before grep gets to apply recursion. Thanks Gilles: I deleted the previous comment with incorrect syntax, and tested the ammended version, but it doesn't work without the (for an unexpected reason to me at least).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |