LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


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

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


Team,

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:
Code:
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/test.home.net <PID> Unix <hard_limit> 0 <bytes_modified_sent> 305683 <bytes_scanned> 2222290214 <plugin_name> Linux File System <Group> TestGroup <account_name> test.home.net <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/test.home.net <targetCid> 48324b01cdddd5355ff6f52379c8be278d040d90 <errorcode> 10019 <client_name> test.home.net
Swatch.conf:

Code:
watchfor /MCS:BS:/
        echo
        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:
test.home.net,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.

Code:
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.

Thanks
Gadikota
 
  


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:41 AM.

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