LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-08-2019, 01:59 AM   #1
jnagaraj82@gmail.com
LQ Newbie
 
Registered: Feb 2019
Posts: 7

Rep: Reputation: 0
Converting CSV file to syslog


Hi Team,

Just wanted to address you few things of what am looking out.

We do get CSV file from developer team as I am looking for to extract the contents of CVS file into rsyslog which internally passes on to our receiver.

2) Is there any options to convert the CSV file into log file and internally passes to our receiver.

I have read many of google documentation wherein it didnot my requirement.

Can you please anybody help me out.

Thanks
Nagaraj
 
Old 02-08-2019, 02:58 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
What do you man by "converting" ?. Are you simply wanting to send the entire file as-is to rsyslog ?. If so see "man logger".
If you want to process the data first, only you can decide on that - maybe grep or sed or awk or perl or python or ... whatever you already know.
 
1 members found this post helpful.
Old 02-08-2019, 03:20 AM   #3
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Rep: Reputation: 290Reputation: 290Reputation: 290
...more, I suggest you use another username because:
  • here at LQ we don't answer questions by email so anybody can read answers for similar issues (s)he can have,
  • any spammer could grab your email address as it's a public forum.
 
1 members found this post helpful.
Old 02-08-2019, 07:16 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by jnagaraj82@gmail.com View Post
Hi Team,
Just wanted to address you few things of what am looking out.

We do get CSV file from developer team as I am looking for to extract the contents of CVS file into rsyslog which internally passes on to our receiver.

2) Is there any options to convert the CSV file into log file and internally passes to our receiver.

I have read many of google documentation wherein it didnot my requirement.
Oh? Which links did you read??? And as others have asked, you need to provide actual details, because we have nothing to go on, based on what you posted. Best question is WHY you need to insert a CSV file into a system log. What are you actually trying to accomplish?

Why can your 'developer' not output things in syslog format, since they are *DEVELOPERS*, and write code for a living? Have you looked at the 'logger' command? Or read the documentation on rsyslog (which you mention), and the imfile directive??
 
Old 02-25-2019, 04:30 AM   #5
jnagaraj82@gmail.com
LQ Newbie
 
Registered: Feb 2019
Posts: 7

Original Poster
Rep: Reputation: 0
Hello Team,

Thanks for your response.

Sorry for the confusion over here from my side. As I have Signed up for the first time.

1) I have received a "csv" files from "Developer Team" in which they have extracted the files from "AS400".
Request you to find the below mentioned cvs contents.

CAENTL CASEQN CACODE CAENTT CATSTP CAJOB CAUSER CANBR CAPGM CAPGMLIB CAPGMDEV CAPGMASP CARES1 CAUSPF CASYNM CARES2 CASYSSEQ CARCV CARCVLIB
6467 110951366 T CA 2018-11-19-07.52.01.411392 SRV223C REDDIP 416052 TURCWXO2 SOFTTURN *SYSBAS 1 0 REDDIP GALAXY 0 1.16643E+19 AUDRCV2607 QGPL


2) The first lines contains the header.
3) The second lines contains the contents of the data. Multiple CSV file data contains 600 lines.

Requirement : -

"All these data which is inside CSV files should be parsed into /var/log/abc.log files".

Would like to know what are all the methods can be applied to parse these data?
Is there any specific script can be developed to do this activity?

Just would like to inform you that am new to coding part. Can anybody help me out in this?
 
Old 02-25-2019, 06:56 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by jnagaraj82@gmail.com View Post
Hello Team,
Thanks for your response. Sorry for the confusion over here from my side. As I have Signed up for the first time.
That's fine, but asking ANY question ANYWHERE without details isn't good. And please note that we don't work for your 'team'.
Quote:
1) I have received a "csv" files from "Developer Team" in which they have extracted the files from "AS400".
So then why don't you ask your 'Developer Team' to give you the data in a different format, since they write software???
Quote:
Request you to find the below mentioned cvs contents.

CAENTL CASEQN CACODE CAENTT CATSTP CAJOB CAUSER CANBR CAPGM CAPGMLIB CAPGMDEV CAPGMASP CARES1 CAUSPF CASYNM CARES2 CASYSSEQ CARCV CARCVLIB
6467 110951366 T CA 2018-11-19-07.52.01.411392 SRV223C REDDIP 416052 TURCWXO2 SOFTTURN *SYSBAS 1 0 REDDIP GALAXY 0 1.16643E+19 AUDRCV2607 QGPL

2) The first lines contains the header.
3) The second lines contains the contents of the data. Multiple CSV file data contains 600 lines.

Requirement : -
"All these data which is inside CSV files should be parsed into /var/log/abc.log files".

Would like to know what are all the methods can be applied to parse these data?
There are THOUSANDS of ways to parse this data, and we cannot (and will not), even attempt to list them all. Again, as asked before, why can't your developers give you this data in whatever format you'd like?? And again, have you looked at the logger program, which inserts things into your system logs?? Also, we don't know what fields are important to you, how you want the data structured, etc. That's for you to decide.
Quote:
Is there any specific script can be developed to do this activity?
Yes, a script CAN be developed to do this, fairly easily.
Quote:
Just would like to inform you that am new to coding part. Can anybody help me out in this?
We will gladly help you...so post what you have written/done/tried so far, and tell us where you're stuck. You say you have a 'team' of developers...why can they not then help you DEVELOP something? There are also thousands of bash scripting tutorials, covering how to loop through files, split lines up based on delimiters, assign them to variables, and output the data in different formats. The tutorials at tldp.com are probably the best to get you started.

Read the "Question Guidelines" link...we will be glad to help, but we aren't going to write scripts for you.
 
Old 02-25-2019, 08:04 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
did you check post #2 already? Is logger suitable for you? How do you want to process that data?
 
Old 02-26-2019, 01:00 AM   #8
jnagaraj82@gmail.com
LQ Newbie
 
Registered: Feb 2019
Posts: 7

Original Poster
Rep: Reputation: 0
Hello Team,

Below is the information from CSV file.

6467 110951366 T CA 2018-11-19-07.52.01.411392 SRV223C REDDIP 416052 TURCWXO2 SOFTTURN *SYSBAS 1 0 REDDIP GALAXY 0 1.16643E+19 AUDRCV2607 QGPL *SYSBAS
6467 110951368 T CA 2018-11-19-07.52.01.417712 SRV223C REDDIP 416052 TURCWXO2 SOFTTURN *SYSBAS 1 0 REDDIP GALAXY 0 1.16643E+19 AUDRCV2607 QGPL *SYSBAS
6467 110999992 T CA 2018-11-19-08.05.36.723936 QPADEV0006 SUMITHA 415599 LSAMSAUDIT SUMITHA *SYSBAS 1 0 SUMITHA GALAXY 0 1.16643E+19 AUDRCV2607 QGPL *SYSBAS
6467 110999998 T CA 2018-11-19-08.05.36.772160 QPADEV0006 SUMITHA 415599 LSAMSAUDIT SUMITHA *SYSBAS 1 0 SUMITHA GALAXY 0 1.16643E+19 AUDRCV2607 QGPL *SYSBAS
6467 111018649 T CA 2018-11-19-08.10.31.492208 QPADEV0006 SUMITHA 415599 QSECCAJE QSYS *SYSBAS 1 0 SUMITHA GALAXY 0 1.16643E+19 AUDRCV2607 QGPL *SYSBAS
6467 111018655 T CA 2018-11-19-08.10.31.529200 QPADEV0006 SUMITHA 415599 QSECCAJE QSYS *SYSBAS 1 0 SUMITHA GALAXY 0 1.16643E+19 AUDRCV2607 QGPL *SYSBAS
6467 111018658 T CA 2018-11-19-08.10.31.553808 QPADEV0006 SUMITHA 415599 QSECCAJE QSYS *SYSBAS 1 0 SUMITHA GALAXY 0 1.16643E+19 AUDRCV2607 QGPL *SYSBAS
6467 111018659 T CA 2018-11-19-08.10.31.561376 QPADEV0006 SUMITHA 415599 QSECCAJE QSYS *SYSBAS 1 0 SUMITHA GALAXY 0 1.16643E+19 AUDRCV2607 QGPL *SYSBAS

Now we want to get these data and need to put into /var/log/abc.log file which is stored rsyslog. All these logs are parsed in MCafee Security tool.

Manually, am using the command as

logger -p local5.notice "6467 110951366 T CA 2018-11-19-07.52.01.411392 SRV223C REDDIP 416052 TURCWXO2 SOFTTURN *SYSBAS 1 0 REDDIP GALAXY 0 1.16643E+19 AUDRCV2607 QGPL *SYSBAS"

By doing this manually am able to get the data in MCAfee Security tool.

If I want to automate this process would like to know is there any mechanism to extract the data from csv file and storing into /var/log/abc.log?
 
Old 02-26-2019, 01:18 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
where is this file coming from (and how?)
 
Old 02-26-2019, 04:26 AM   #10
jnagaraj82@gmail.com
LQ Newbie
 
Registered: Feb 2019
Posts: 7

Original Poster
Rep: Reputation: 0
Team will generate this report from AS400.
 
Old 02-26-2019, 05:59 AM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
and how did you get this file? How often? How do you know it has been changed? Which part do you want to put into log?
 
Old 02-26-2019, 07:21 AM   #12
jnagaraj82@gmail.com
LQ Newbie
 
Registered: Feb 2019
Posts: 7

Original Poster
Rep: Reputation: 0
This report has been provided by engineering team in which they work on AS400 for audit point of view. The security team have ask them the report.

As they have provided us in CSV format.

Now I need to extract these data from CSV file and put into /var/log/abc.log files.
 
Old 02-26-2019, 07:22 AM   #13
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
what do you mean by extract data from csv?
 
Old 02-26-2019, 07:47 AM   #14
jnagaraj82@gmail.com
LQ Newbie
 
Registered: Feb 2019
Posts: 7

Original Poster
Rep: Reputation: 0
I mean to say

The data which are in CSV file needs to parse the data into /var/log/abc.log files
 
Old 02-26-2019, 07:59 AM   #15
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by jnagaraj82@gmail.com View Post
Hello Team,
Again, we are NOT on your 'team' and are not your co-workers.
Quote:
Below is the information from CSV file.
Code:
6467	110951366	T	CA	2018-11-19-07.52.01.411392	SRV223C   	REDDIP    	416052	TURCWXO2  	SOFTTURN  	*SYSBAS   	1	0	REDDIP    	GALAXY  	0	1.16643E+19	AUDRCV2607	QGPL      	*SYSBAS   
6467	110951368	T	CA	2018-11-19-07.52.01.417712	SRV223C   	REDDIP    	416052	TURCWXO2  	SOFTTURN  	*SYSBAS   	1	0	REDDIP    	GALAXY  	0	1.16643E+19	AUDRCV2607	QGPL      	*SYSBAS   
6467	110999992	T	CA	2018-11-19-08.05.36.723936	QPADEV0006	SUMITHA   	415599	LSAMSAUDIT	SUMITHA   	*SYSBAS   	1	0	SUMITHA   	GALAXY  	0	1.16643E+19	AUDRCV2607	QGPL      	*SYSBAS   
6467	110999998	T	CA	2018-11-19-08.05.36.772160	QPADEV0006	SUMITHA   	415599	LSAMSAUDIT	SUMITHA   	*SYSBAS   	1	0	SUMITHA   	GALAXY  	0	1.16643E+19	AUDRCV2607	QGPL      	*SYSBAS   
6467	111018649	T	CA	2018-11-19-08.10.31.492208	QPADEV0006	SUMITHA   	415599	QSECCAJE  	QSYS      	*SYSBAS   	1	0	SUMITHA   	GALAXY  	0	1.16643E+19	AUDRCV2607	QGPL      	*SYSBAS   
6467	111018655	T	CA	2018-11-19-08.10.31.529200	QPADEV0006	SUMITHA   	415599	QSECCAJE  	QSYS      	*SYSBAS   	1	0	SUMITHA   	GALAXY  	0	1.16643E+19	AUDRCV2607	QGPL      	*SYSBAS   
6467	111018658	T	CA	2018-11-19-08.10.31.553808	QPADEV0006	SUMITHA   	415599	QSECCAJE  	QSYS      	*SYSBAS   	1	0	SUMITHA   	GALAXY  	0	1.16643E+19	AUDRCV2607	QGPL      	*SYSBAS   
6467	111018659	T	CA	2018-11-19-08.10.31.561376	QPADEV0006	SUMITHA   	415599	QSECCAJE  	QSYS      	*SYSBAS   	1	0	SUMITHA   	GALAXY  	0	1.16643E+19	AUDRCV2607	QGPL      	*SYSBAS
Now we want to get these data and need to put into /var/log/abc.log file which is stored rsyslog. All these logs are parsed in MCafee Security tool.
Right. This is what you said before. You were also asked numerous questions before, too, but haven't answered them.
Quote:
Manually, am using the command as
Code:
logger -p local5.notice "6467	110951366	T	CA	2018-11-19-07.52.01.411392	SRV223C   	REDDIP    	416052	TURCWXO2  	SOFTTURN  	*SYSBAS   	1	0	REDDIP    	GALAXY  	0	1.16643E+19	AUDRCV2607	QGPL      	*SYSBAS"
By doing this manually am able to get the data in MCAfee Security tool. If I want to automate this process would like to know is there any mechanism to extract the data from csv file and storing into /var/log/abc.log?
AGAIN: Yes there is...that would be by **YOU** writing a script to pull out the data you're wanting, parsing it, and using the logger tool to insert it. AGAIN, we WILL NOT write your scripts for you.
Quote:
Originally Posted by jnagaraj82@gmail.com
Team will generate this report from AS400.
AGAIN, why can you not ask your 'developer team' to actually DEVELOP something for you? Or at the very least give you the data in a different format??
Quote:
Originally Posted by jnagaraj82@gmail.com
This report has been provided by engineering team in which they work on AS400 for audit point of view. The security team have ask them the report.
As they have provided us in CSV format. Now I need to extract these data from CSV file and put into /var/log/abc.log files.
So you have an 'engineering team', a 'security team', and a 'developer team'...yet the developers can't give you different data output, and the security team doesn't want to be involved in getting the data into the security logs, and the engineering team is ALREADY generating a report for the auditors/security?? So why can't the engineering team also provide a report to security?? And with all these 'teams', is there no one there that can write a fairly simple bash script??

Restating your wants/needs over and over isn't helpful. Again, we understand FULLY what you're trying to do, but AGAIN...we **WILL NOT** write your scripts for you. You were given advice, pointed to bash scripting tutorials, and given the name of a tool (which you're now using), to insert these things into system logs. It is now time for YOU to actually begin to do the work that you've been asked to do. Again, we are happy to help you if you're stuck, but you have yet to actually show any efforts of your own to get this done.

So:
  • Look at ANY of the many thousands of easily found bash scripting tutorials.
  • Find examples of how to read a file and loop through it until the end.
  • Find examples of how to split a line apart and assign those things to variables
  • Put those variables into a simple command-line that you **ALREADY HAVE** (the 'logger' line from above)
That's it. Your script is now done.
 
1 members found this post helpful.
  


Reply



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
How to print lines in csv file if 1 csv column field = "text". There are 10 column (;) in csv file nexuslinux Linux - Newbie 9 04-22-2016 11:35 PM
[SOLVED] A challenging script - Replace field of CSV file based on another CSV file arbex5 Programming 11 06-12-2013 06:56 AM
Converting .txt file to a csv file kamesp Linux - Software 9 04-20-2013 07:45 AM
[SOLVED] How to script csv editing? Remove rows from csv file that do not contain certain text ingram87 Linux - Software 9 08-03-2012 12:45 PM
Comparing two csv files and write different record in third CSV file irfanb146 Linux - Newbie 3 06-30-2008 09:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:50 PM.

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