Sponsored Content
Top Forums Shell Programming and Scripting How to grep logs for errors and receive specific additional lines? Post 302855773 by nbsparks on Friday 20th of September 2013 08:13:08 PM
Old 09-20-2013
I threw out 10 lines as an arbitrary number because it could really vary. I would think that 10 lines would be MORE than I need most of the time. And I wouldn't want to hardcode on "Mobcatcher" as it could be any number of server plugins that could fail or error out.

The idea is for me to be able to troubleshoot and diagnose server issues with this subset of the logfile rather than looking at this logfile, noting the time, and then sifting through the main server.log file to get the context I need to troubleshoot.

---------- Post updated at 05:13 PM ---------- Previous update was at 05:11 PM ----------

I suppose that one could parse the [SEVERE] line and then look for any lines within the previous 10-20 lines that mention any of the words used in the same line as the [SEVERE] tag, but that seems overkill and unnecessary complication.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

retrieving specific lines from a file - can I use grep ?

Hi there, if i had a file that looked like this my_server1 red green blue yellow blue my_server2 blue blue yellow green blue my_server3 yellow (9 Replies)
Discussion started by: hcclnoodles
9 Replies

2. Shell Programming and Scripting

Grep for lines in web logs

I want to find the unique url in a apache logs which got 404 error . I can do something like "cat apache.log|grep 404|awk '{print $2,$3}'|grep 404 this will give me say /foo.html 404 /foo.html 404 /foo.html 404 /bar.html 404 /cat.html 404 However my output should only find... (3 Replies)
Discussion started by: gubbu
3 Replies

3. UNIX Desktop Questions & Answers

grep lines with two specific characters somewhere in the line

I'm having trouble with extracting certain lines from a file based on whether they have all the required fields. Original file: snt:594:Sam N This bpt:2342:Bob P That lr:123 wrp:23:Whoever Person cor:794 Desired output: snt:594:Sam N This bpt:2342:Bob P That wrp:23:Whoever Person ... (3 Replies)
Discussion started by: Chthonic
3 Replies

4. Shell Programming and Scripting

Extracting specific lines of data from a file and related lines of data based on a grep value range?

Hi, I have one file, say file 1, that has data like below where 19900107 is the date, 19900107 12 144 129 0.7380047 19900108 12 168 129 0.3149017 19900109 12 192 129 3.2766666E-02 ... (3 Replies)
Discussion started by: Wynner
3 Replies

5. Shell Programming and Scripting

Problems to print specific lines with awk and grep...HELP!

Hi all I have data like this: model: 1, misfit value: 0.74987 1 1.182 1.735 2.056 1.867 2 0.503 1.843 2.018 1.888 3 2.706 2.952 2.979 1.882 4 8.015 3.414 3.675 1.874 ... (1 Reply)
Discussion started by: fedora2011
1 Replies

6. Shell Programming and Scripting

using awk to get specific section of lines in logs

i have a log file that has the date and time that looks like this: Wed Jun 28 15:46:21 2012 test failed tailed passed passed not error panic what we want to focus on is the first 5 columns because they contain the date and time. the date and time can be anywhere on the line. in this... (6 Replies)
Discussion started by: SkySmart
6 Replies

7. Shell Programming and Scripting

grep the output between specific lines

Symmetrix ID : 00000001234 Host Name : myown Identifiers Found : 5000000000000000 5000000000000001 Device Cap(MB) Attr Dir:P ------ ------- ---- ---- 1234 25886 (M) 8D:1, 9D:1 0123 25886 (M) 8D:1, 9D:1 1345 25886 (M) ... (5 Replies)
Discussion started by: maddy.san
5 Replies

8. Shell Programming and Scripting

Script to grep logs for Errors

Hi Guys, I want to write a script which can grep the logs (server.log) from a file for Error String and output to a other file. Problems: How to know about the errors only between the current restart and not in previous as server.log has earlier restarts also? thanks for the help! Much... (5 Replies)
Discussion started by: ankur328
5 Replies

9. UNIX for Dummies Questions & Answers

Grep specific lines

Hello I have a file with nearly 90000 lines in x,y,z format but have some lines that I do not need to show. Is there anyway to delete those 3 lines after every 288 lines. Eg I keep the first 288 lines delete (289, 290 291); keep the next 288 lines after those and so on... Thanks (6 Replies)
Discussion started by: Madiouma Ndiaye
6 Replies

10. Shell Programming and Scripting

Grep content between specific lines

cat file1 *FileHeader* Partition 0 Total Data Bytes 1416 Avg Bytes/Record 1416 Others 1 PRDX22.AUDIT_DATA_INFO Partition 4 Total Data Bytes 4615 Avg... (8 Replies)
Discussion started by: Veera_V
8 Replies
DHISD(8)						    BSD System Manager's Manual 						  DHISD(8)

NAME
dhisd -- Dynamic Host Information System server. SYNOPSIS
dhisd [-D] [-p port] [-d database] [-s services] [-l logfile] [-P pidfile] DESCRIPTION
DHIS is a client-server architecture meant to update databases for systems which are assigned a dynamic IP[v4] address. By the means of a DHIS client a host which is assigned a dynamic IP address (either from its ISP or from DHCP) is able to communicate with a DHIS server in order to advertise its newly acquired IP address. DHIS comprises a UDP based protocol to achieve this purpose. A DHIS client has a unique identification number and a set of authentication keys, runs in background, and attempts to reach its server. The DHIS server (permanently online) listens to UDP messages from its clients and authenticates these against its knowledge of keys. When authentication is successful the DHIS server updates one or more databases with the newly received IP address for the given client. The server then keeps sending, every period of time, check requests to each of its connected clients. These need to be acknowledged. If not the server will consider, on an individual basis, that the client has disconnected and will again update the databases to an offline state. Alternativelly the server may receive an OFFLINE_REQ packet from the client, in which case the DNS record is updated at once and the online state droped. OPTIONS
-D Increase debug level. -p port Specify port to listen on. If not specified, the default is port 58800. -d database Use an alternative database file instead of /etc/dhis-server/dhis.db. -s services Use an alternative database file instead of /etc/dhis-server/services.db. -l logfile Use an alternative log file instead of /var/log/dhisd.log. -P pidfile Use an alternative PID file instead of /var/run/dhisd.pid. FILES
/etc/dhis-server/dhis.db DHIS client database. Contains the credentials of clients. /etc/dhis-server/services.db DHIS service database. Contains a list of services and the location of the corresponding DHIS engine plugins. SEE ALSO
dhis-genkeys(8) AUTHOR
dhisd has been written by Joao Cabral <jcnc@dhis.org>. This manual page was written by Guus Sliepen <guus@debian.org> for the Debian GNU/Linux system. Debian GNU/Linux June 1, 2019 Debian GNU/Linux
All times are GMT -4. The time now is 10:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy