Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-18-2015, 03:19 PM   #1
LQ Newbie
Registered: Dec 2010
Posts: 26

Rep: Reputation: 0
Help with Swatch.conf exec command !!!


I have application where it sends the information to syslog server in XML format.

The requirement is that we have to use that XML output and manipulate and out it in certain format. I cant use Nth column as the data changes with the length of the message. With that said, I am wondering where I am doing wrong.

XML input in to Syslog file:
Jun 18 13:02:04 avamar MCS:BS::ACTIVITY::STOP: <Code> 30010 <Type> INFORMATION <Severity> PROCESS <Category> SECURITY <HwSource> avamar <Summary> Activity cancelled. <status_code> 30010 <endtime> 2015-06-18 20:02:04 <WID> TestGroup-1434657706517 <starttime> 2015-06-18 20:01:46 <client> /clients/linux/ <PID> Unix <hard_limit> 0 <bytes_modified_sent> 305683 <bytes_scanned> 2222290214 <plugin_name> Linux File System <Group> TestGroup <account_name> <CID> 48324b01cdddd5355ff6f52379c8be278d040d90 <schedule> Admin On-Demand Schedule <snapup_number> 239 <Action> On-Demand Backup <snapup_label> TestGroup-1434657706517 <dataset> /Default Dataset <retention_policy> Minimal Retention <domain> /clients/linux <account> /clients/linux/ <targetCid> 48324b01cdddd5355ff6f52379c8be278d040d90 <errorcode> 10019 <client_name>

watchfor /MCS:BS:/
        exec echo $0 | awk -v date="$(date +'%m/%d/%y %H:%M:%S')" -v g="$(echo $0 | awk '{print $NF}')" -v pgp="$(cat bkpClient_pgp.csv | grep $g | cut -d, -f2)" -v grp="$(echo $0 | grep -Po '(?<=Group>\s)[^\s]*')" '{print $NF","$(NF-2)","$4","date","pgp","grp}' >> /var/log/avamar-formatted
Expected Output:
Code:,10019,avamar,06/18/15 13:02:04,pgp1083,TestGroup
Instead the file /var/log/avamar-formatted shows up as empty and below lines on the terminal.

sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file

Please let me know where i am doing wrong. Thanks in advance.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
EXEC command in Linux richa07 Linux - Newbie 5 07-03-2013 12:41 PM
exec command help vicky007aggrwal Linux - Newbie 4 10-28-2012 07:49 AM
exec command travix Linux - Newbie 2 09-15-2012 12:59 PM
find command with exec cola Linux - Newbie 5 06-01-2010 01:25 PM
exec bash command bendeco13 Linux - General 6 10-31-2004 03:50 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration