Registrations to Open-AudIT forums are now closed. To ask any new questions please visit Opmantek Community Questions.

Open-AudIT

What's on your network?
It is currently Tue Mar 19, 2024 8:48 pm

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
PostPosted: Sat Sep 15, 2018 12:02 am 
Offline
Contributor

Joined: Wed Apr 07, 2010 8:04 am
Posts: 105
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: 1259
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[/code]

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: 105
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: 1259
Great. Copy-n-paste and search-replace so I didn't notice either.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 2 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