PDA

View Full Version : How to convert log file data into sqlite database?



Newbie89
April 27th, 2013, 10:30 AM
previously is used log file to save data. Now I need to identify the variables which need to logged and save into sqlite database.Any idea on how to start?thanks

Martin Witte
April 27th, 2013, 03:05 PM
You can import a comma seperated text file directly in sqllite, see http://www.sqlite.org/cvstrac/wiki?p=ImportingFiles. So the recipe would be to convert your logfile to a comma seperated file. Next create a table in sqllite with all the attributes of your log file, e.g. severity, date/time, source code line, error mesage. Finally import the logfile

Newbie89
April 28th, 2013, 07:34 AM
You can import a comma seperated text file directly in sqllite, see http://www.sqlite.org/cvstrac/wiki?p=ImportingFiles. So the recipe would be to convert your logfile to a comma seperated file. Next create a table in sqllite with all the attributes of your log file, e.g. severity, date/time, source code line, error mesage. Finally import the logfile

thanks for the information...can you show me the example of "create a table in sqllite with all the attributes of your log file, e.g. severity, date/time, source code line, error mesage."
I'm not very know how to do it...thanks.

Bodsda
April 28th, 2013, 10:19 AM
thanks for the information...can you show me the example of "create a table in sqllite with all the attributes of your log file, e.g. severity, date/time, source code line, error mesage."
I'm not very know how to do it...thanks.

There is a simple example in the link that was posted.
I suggest you read that first and then ask for further help if you're still having problems.

Bodsda

Newbie89
April 29th, 2013, 05:41 AM
Is it just identify the variable in the C file then create a table only to link it?Let say my C file got this variable as shown below:

struct HOST
{
char Src_MAC[18];
char Src_IP[16];
long int Cap_Bytes;
int TCP,UDP,ICMP,IP,ARP,OTH_Net, OTH_Trans; // Protocols
int ftp,ssh,telnet,domain,www,netbios,other; // Services
};