Sponsored Content
Full Discussion: Log file query
Special Forums UNIX and Linux Applications Infrastructure Monitoring Log file query Post 302416204 by LAVco on Sunday 25th of April 2010 02:15:04 PM
Old 04-25-2010
Log file query

Hello all,

I am trying to query a log file based on 5 conditions; Information, Warning, Error or Warning, Error or Information, Warning, Error.

Sample of the log file:
Code:
2010-04-25 12:47:06 Information: Network-Socket(1) process started.
2010-04-25 12:47:09 Information: SNMP-Socket(1-1) process started.
2010-04-25 12:47:34 Information: SNMP-Socket(1-1) process stopped.
2010-04-25 12:47:34 Information: Network-Socket(1) process stopped.
2010-04-25 12:47:34 Information: Network-Socket(2) process started.
2010-04-25 12:47:37 Information: Network-Socket(2) host ping failed.
2010-04-25 12:47:37 Error: Network-Socket(2) process aborted.
2010-04-25 12:47:37 Information: Network-Socket(3) is disabled.
2010-04-25 12:52:09 Information: Network-Socket(1) process started.
2010-04-25 12:52:11 Information: SNMP-Socket(1-1) process started.
2010-04-25 12:52:33 Information: SNMP-Socket(1-1) process stopped.
2010-04-25 12:52:33 Information: Network-Socket(1) process stopped.
2010-04-25 12:52:33 Information: Network-Socket(2) process started.
2010-04-25 12:52:33 Information: FTP-Socket(2-1) process started.
--2010-04-25 12:52:33--  ftp://192.168.2.101/chan1.jpg
           => `/home/idas/das/var/NS.CH.RNSRP.FTP_FILE-2-1-1.20100425T155208.tmp'
Connecting to 192.168.2.101:21... failed: No route to host.
2010-04-25 12:52:36 Error: FTP-Socket(2-1) remote file(1) get failed (/chan1.jpg).
2010-04-25 12:52:37 Information: FTP-Socket(2-1) process stopped.
2010-04-25 12:52:37 Information: Network-Socket(2) process stopped.
2010-04-25 12:52:37 Information: Network-Socket(3) is disabled.

Also, the output doesn't require error output details e.g.
Code:
--2010-04-25 12:52:33--  ftp://192.168.2.101/chan1.jpg
           => `/home/idas/das/var/NS.CH.RNSRP.FTP_FILE-2-1-1.20100425T155208.tmp'

There was a recent posting using awk that was close but it wasn't outputting the timestamps. Any assistance with this would be appreciated.

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

query file name

Experts, New Year Greetings to everyone! Is there a way I can query the filename from the file itself? I am writing a bunch of similar 'csh' scripts, which differ by the file name and same difference is inside the script. e.g. script1.run.csh .... set vrbl = script1 ....... (3 Replies)
Discussion started by: sumitgarg
3 Replies

2. Shell Programming and Scripting

file name query

Hi Everyone . i m kinda newbie so spare me if question seems stupid :D what i want to do is something like this rsh node1 tail -20 /var/opt/fds/statistics/FSC-InapInterface_2.0_A_1-2006-12-24-0000.stat >> node1.txt now problem is this that in this case the date was 24th december 2006 but... (5 Replies)
Discussion started by: Dastard
5 Replies

3. Solaris

Net-SNMP v5.4 - sub-id not found in log, but can query with snmpget and snmpwalk

Hi everyone, I'm configuring Net-SNMP v5.4 on Solaris 10, sending traps to OpenNMS 1.2.9-0.20061212.0. I'm setting up disk monitoring (% of space free) for 5 directories. Here's what I'm working with: (snmpd.conf - disk and monitoring portions) # # Disk Usage monitoring: # disk / 20%... (0 Replies)
Discussion started by: Mariognarly
0 Replies

4. Shell Programming and Scripting

add the output of a query to a variable to be used in another query

I would like to use the result of a query in another query. How do I redirect/add the output to another variable? $result = odbc_exec($connect, $query); while ($row = odbc_fetch_array($result)) { echo $row,"\n"; } odbc_close($connect); ?> This will output hostnames: host1... (0 Replies)
Discussion started by: hazno
0 Replies

5. Shell Programming and Scripting

Query on File checking

Hi All, I am a newbie to Shell programming and stuck with the folllowing issue: Here is the code: #! /bin/sh if ; then echo "Checking if the file is found or not" fi On running, I get the following error: spk265@linax1$ ./shell ./sample/samplenew ./shell: line 3: I... (3 Replies)
Discussion started by: sh_kk
3 Replies

6. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

7. Shell Programming and Scripting

Query a oracle DB when fail put in in the error log

Hi all, I'm trying to create a script that does the following: Connect with SQLplus to my oracle db. Do a select 1 from dual; and when I don't get a value back. Than put the $DATE in a logfile. What I have until now: #!/bin/bash # values GEN_ERR=1 #error 1 code USER=username... (8 Replies)
Discussion started by: Roadster
8 Replies

8. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

9. Shell Programming and Scripting

Renaming file - Query

Hi, I have file with format abcd.gz.20151011.1 , i need to rename as abcd.gz.20151011.we can use move command for one file. How to change multiple files. (3 Replies)
Discussion started by: nag_sathi
3 Replies

10. Shell Programming and Scripting

Replacement Query in a file

Hi All, Please can you help me with below, i have a file with records ( eg of one record below) Record R1 - The field separtaor between records is | (Pipe) |123|Mukesh\r\n|Vivek"sharma| Now i want to do the following for each record in the file if there is any field ( lets say field... (3 Replies)
Discussion started by: mad_man12
3 Replies
IO::Socket::UNIX(3pm)					 Perl Programmers Reference Guide				     IO::Socket::UNIX(3pm)

NAME
IO::Socket::UNIX - Object interface for AF_UNIX domain sockets SYNOPSIS
use IO::Socket::UNIX; DESCRIPTION
"IO::Socket::UNIX" provides an object interface to creating and using sockets in the AF_UNIX domain. It is built upon the IO::Socket interface and inherits all the methods defined by IO::Socket. CONSTRUCTOR
new ( [ARGS] ) Creates an "IO::Socket::UNIX" object, which is a reference to a newly created symbol (see the "Symbol" package). "new" optionally takes arguments, these arguments are in key-value pairs. In addition to the key-value pairs accepted by IO::Socket, "IO::Socket::UNIX" provides. Type Type of socket (eg SOCK_STREAM or SOCK_DGRAM) Local Path to local fifo Peer Path to peer fifo Listen Create a listen socket If the constructor is only passed a single argument, it is assumed to be a "Peer" specification. NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE As of VERSION 1.18 all IO::Socket objects have autoflush turned on by default. This was not the case with earlier releases. NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE METHODS
hostpath() Returns the pathname to the fifo at the local end peerpath() Returns the pathanme to the fifo at the peer end SEE ALSO
Socket, IO::Socket AUTHOR
Graham Barr. Currently maintained by the Perl Porters. Please report all bugs to <perlbug@perl.org>. COPYRIGHT
Copyright (c) 1996-8 Graham Barr <gbarr@pobox.com>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2014-01-06 IO::Socket::UNIX(3pm)
All times are GMT -4. The time now is 03:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy