Need AWk To parse XML logs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need AWk To parse XML logs
# 1  
Old 05-08-2008
Need AWk To parse XML logs

Hi , I need an Awk script to parse my log file .
Code:
2008-04-26 10:00:13,391 [Delivery0] INFO   Logger  - <?xml version="1.0" encoding="UTF-8" standalone="no"?><2dm
tmsg xmlns:xsi="http://www.xx.org/2001/XMLSchema-instance"><msgTimeStamp>2008-04-26T12:00:11</msgTimeStamp><Id>4740</Id><cur>EXY</cur><sol>889</sol><Type>210</Type><Status>ACTIVE</Status>

This is how my xml file looks like , I would want to get output like
msgTimeStamp Id cur sol Type Status
example
Code:
2008-04-26T12:00:11 4740 EXY 889 210 ACTIVE

any help pls ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash Script to parse Perforce Logs

Hi All, I need to write a bash script that will parse some perforce log files, the log files will contain user login information, the script would need to pare the log, and check who logs in, and if the user is a superadmin, then the script will check the ip address to see which server the... (4 Replies)
Discussion started by: BostonRob
4 Replies

2. Shell Programming and Scripting

awk Script to parse a XML tag

I have an XML tag like this: <property name="agent" value="/var/tmp/root/eclipse" /> Is there way using awk that i can get the value from the above tag. So the output should be: /var/tmp/root/eclipse Help will be appreciated. Regards, Adi (6 Replies)
Discussion started by: asirohi
6 Replies

3. Shell Programming and Scripting

sed script to parse logs issue

I have this script to parse some logs: #!/bin/bash id=$1 shift sed "/(id=$id)/,/^$/!d" "$@" Usage: ./script.sh 1234 logfile The logs have an empty line before the logged events/timestamps -- most of the time. And this is my issue, since when there is no empty line, it will catch things... (4 Replies)
Discussion started by: KidCactus
4 Replies

4. Shell Programming and Scripting

Please Help with AWK to parse rapidly changing XML messages

Hi Guy's Can I please get some help with this code. I have xml feed file which rapidly changing temporary file and I need to capture the content of this file as soon as data arrives. Example of the data Required data output Time is current time. This is awk code that I have so far... (4 Replies)
Discussion started by: James_Owen
4 Replies

5. Shell Programming and Scripting

AWK to Parse XML messages

Hello Guys, Please help with AWK problem. I have XML file which contains a list of messages for subjects. Example of the messages: , message=, message=, message=, message=, message=, message=, message=, message= I want to use AWK to parse these xml messages but I am... (7 Replies)
Discussion started by: James_Owen
7 Replies

6. Shell Programming and Scripting

python - wget xml doc and parse with awk

Well, that's what I'd do in bash :) Here's what I have so far: import urllib2 from BeautifulSoup import BeautifulStoneSoup xml = urllib2.urlopen('http://weatherlink.com/xml.php?user=blah&pass=blah') soup = BeautifulStoneSoup(xml) print soup.prettify() but all it does is grab the html... (0 Replies)
Discussion started by: unclecameron
0 Replies

7. Shell Programming and Scripting

Shell script (not Perl) to parse xml with awk

Hi, I have to make an script according to these: - I have couples of files like: xxxxxxxxxxxxx.csv xxxxxxxxxxxxx_desc.xml - every xml file has diferent fields, but keeps this format: ........ <defaultName>2011-02-25T16:43:43.582Z</defaultName> ........... (2 Replies)
Discussion started by: Pluff
2 Replies

8. UNIX for Dummies Questions & Answers

Parse XML e report con AWK

Thanks in advance who can answer. I have to make a small shell that after reading an XML file and extract the fields I create a text file with the same fields taken previously in tabular form. I did this parse.awk ---------------------- BEGIN { FS="" } { for(i=2; i<=NF; i+=2) { ... (1 Reply)
Discussion started by: mcarlo65
1 Replies

9. Shell Programming and Scripting

how to parse the file in xml format using awk/nawk

Hi All, I have an xml file with the below format. <a>111</a><b>222</b><c>333<c><d><e>123</e><f>234</f><d><e>456</e><f>789</f> output needed is 111,222,333,123,234 111,222,333,456,789 nawk 'BEGIN{FS="<|>"} {print a,b,c,e,f a="" ... (7 Replies)
Discussion started by: natalie23
7 Replies

10. Shell Programming and Scripting

How to parse a XML file using PERL and XML::DOm

I need to know the way. I have got parsing down some nodes. But I was unable to get the child node perfectly. If you have code please send it. It will be very useful for me. (0 Replies)
Discussion started by: girigopal
0 Replies
Login or Register to Ask a Question
ZoneMinder::Logger(3pm) 				User Contributed Perl Documentation				   ZoneMinder::Logger(3pm)

NAME
ZoneMinder::Logger - ZoneMinder Logger module SYNOPSIS
use ZoneMinder::Logger; use ZoneMinder::Logger qw(:all); logInit( "myproc", DEBUG ); Debug( "This is what is happening" ); Info( "Something interesting is happening" ); Warning( "Something might be going wrong." ); Error( "Something has gone wrong!!" ); Fatal( "Something has gone badly wrong, gotta stop!!" ); Panic( "Something fundamental has gone wrong, die with stack trace ); DESCRIPTION
The ZoneMinder:Logger module contains the common debug and error reporting routines used by the ZoneMinder scripts. To use debug in your scripts you need to include this module, and call logInit. Thereafter you can sprinkle Debug or Error calls etc throughout the code safe in the knowledge that they will be reported to your error log, and possibly the syslogger, in a meaningful and consistent format. Debug is discussed in terms of levels where 1 and above (currently only 1 for scripts) is considered debug, 0 is considered as informational, -1 is a warning, -2 is an error and -3 is a fatal error or panic. Where levels are mentioned below as thresholds the value given and anything with a lower level (ie. more serious) will be included. METHODS
logInit ( $id, %options ); Initialises the debug and prepares the logging for forthcoming operations. If not called explicitly it will be called by the first debug call in your script, but with default (and probably meaningless) options. The only compulsory arguments are $id which must be a string that will identify debug coming from this script in mixed logs. Other options may be provided as below, Option Default Description --------- --------- ----------- level INFO The initial debug level which defines which statements are output and which are ignored trace 0 Whether to use the Carp::shortmess format in debug statements to identify where the debug was emitted from termLevel NOLOG At what level debug is written to terminal standard error, 0 is no, 1 is yes, 2 is write only if terminal databaseLevel INFO At what level debug is written to the Log table in the database; fileLevel NOLOG At what level debug is written to a log file of the format of <id>.log in the standard log directory. syslogLevel INFO At what level debug is written to syslog. To disable any of these action entirely set to NOLOG logTerm (); Used to end the debug session and close any logs etc. Not usually necessary. $id = logId ( [$id] ); $level = logLevel ( [$level] ); $trace = logTrace ( [$trace] ); $level = logLevel ( [$level] ); $termLevel = logTermLevel ( [$termLevel] ); $databaseLevel = logDatabaseLevel ( [$databaseLevel] ); $fileLevel = logFileLevel ( [$fileLevel] ); $syslogLevel = logSyslogLevel ( [$syslogLevel] ); These methods can be used to get and set the current settings as defined in logInit. Debug( $string ); This method will output a debug message if the current debug level permits it, otherwise does nothing. This message will be tagged with the DBG string in the logs. Info( $string ); This method will output an informational message if the current debug level permits it, otherwise does nothing. This message will be tagged with the INF string in the logs. Warning( $string ); This method will output a warning message if the current debug level permits it, otherwise does nothing. This message will be tagged with the WAR string in the logs. Error( $string ); This method will output an error message if the current debug level permits it, otherwise does nothing. This message will be tagged with the ERR string in the logs. Fatal( $string ); This method will output a fatal error message and then die if the current debug level permits it, otherwise does nothing. This message will be tagged with the FAT string in the logs. Panic( $string ); This method will output a panic error message and then die with a stack trace if the current debug level permits it, otherwise does nothing. This message will be tagged with the PNC string in the logs. EXPORT None by default. The :constants tag will export the debug constants which define the various levels of debug The :variables tag will export variables containing the current debug id and level The :functions tag will export the debug functions. This or :all is what you would normally use. The :all tag will export all above symbols. SEE ALSO
Carp Sys::Syslog The ZoneMinder README file Troubleshooting section for an extended discussion on the use and configuration of syslog with ZoneMinder. http://www.zoneminder.com AUTHOR
Philip Coombes, <philip.coombes@zoneminder.com> COPYRIGHT AND LICENSE
Copyright (C) 2001-2008 Philip Coombes This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 830: You forgot a '=back' before '=head2' perl v5.14.2 2011-06-28 ZoneMinder::Logger(3pm)