Open-AudIT

What's on your network?
It is currently Thu Sep 20, 2018 6:46 pm

All times are UTC + 10 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Sep 15, 2018 12:02 am 
Offline
Contributor

Joined: Wed Apr 07, 2010 8:04 am
Posts: 104
Location: Boston, MA
Hi folks,
I'm trying to create an OA report, solely for the purpose of exporting the data to CSV, but I need some help in trying to figure out how to write line breaks in SQL, so they are passed to PHP, and ultimately as CR/LF to the CSV

SELECT service.id as 'ID', 'TechnologyService' as 'Type', service.name as 'Name',
concat('"','http://(servername)/open-audit/index.php/devices/',system.name,
'CR/LF','CR/LF',
'Service Description: ',service.description,'CR/LF',
'Service Executable: ',REPLACE(service.executable,'"',''),'CR/LF',
'Service User: ',service.user,'CR/LF',
'Service Start Mode: ',service.start_mode,'CR/LF',
'Service State: ',service.state,'"') as 'Documentation'
FROM System, Service
WHERE @filter AND system.id = service.system_id


WHERE @filter AND system.id = service.system_id

_________________
Old OA Setup: 500 Windows 7 workstations & 200 Apple OSX with OA v1.5.2 on Windows Server 2003 and WAMP 2
New OA Setup: 100 Windows servers with OA 2.2 on Windows Server 2016 and WAMP 3


Last edited by el_geto on Sat Sep 15, 2018 2:01 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 15, 2018 1:20 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1256
If you want CR/LF I would try:
Code:
SELECT service.id as 'ID', 'TechnologyService' as 'Type', service.name as 'Name',
concat('"','http://(servername)/open-audit/index.php/devices/',system.name,
'\r\n','\r\n',
'Service Description: ',service.description,'\r\n',
'Service Executable: ',REPLACE(service.executable,'"',''),'\r\n',
'Service User: ',service.user,'\r\n',
'Service Start Mode: ',service.start_mode,'\r\n',
'Service State: ',service.state,'"') as 'Documentation'
FROM System, Service
WHERE @filter AND system.id = service.system_id


It seems that OpenAudit creates its CSV file with Line Feeds so for consistency you'd replace '\r\n' above with '\n'.


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 15, 2018 2:02 am 
Offline
Contributor

Joined: Wed Apr 07, 2010 8:04 am
Posts: 104
Location: Boston, MA
Thanks JPA that did the trick. :D

(edited my comment to hide my fqdn, would appreciate if you do the same. bots are watching :!: )

_________________
Old OA Setup: 500 Windows 7 workstations & 200 Apple OSX with OA v1.5.2 on Windows Server 2003 and WAMP 2
New OA Setup: 100 Windows servers with OA 2.2 on Windows Server 2016 and WAMP 3


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 15, 2018 2:05 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1256
Great. Copy-n-paste and search-replace so I didn't notice either.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group