Re: Parsing log file using C#
- From: "Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin@xxxxxxxxx>
- Date: Tue, 8 Apr 2008 14:18:08 -0700 (PDT)
On Apr 8, 3:10 pm, Prem Parekh wrote:
I need code that can parse data from log file.
The log is pipe delimited and in following format:
time=2006-11-03 13:13:56| fw=199.23.48.120| user=tjolen| realm=EMEA| roles=Network Connect| src=24.141.197.139| dstname=| duration=| msg=AUT22670: Login succeeded for tjolen/EMEA.
time=2006-11-03 13:14:07| fw=199.23.48.120| user=tjolen| realm=EMEA| roles=Network Connect| src=63.131.197.139| dstname=TUN-VPN| duration=| msg=JAV20021: Connected to EPN port 443
time=2006-11-03 13:16:10| fw=199.23.38.120| user=tjolen| realm=EMEA| roles=Network Connect| src=34.131.127.139| dstname=| duration=| msg=AUT22673: Logout from 24.131.127.139
Purpose is to read from text file and store in sql server database.
Please help!
Hi,
You can split the line using String.Split( new char[] {'|'}); and then
later split each piece by the '=' then you have a pair of key,value.
.
- References:
- Parsing log file using C#
- From: Prem Parekh
- Parsing log file using C#
- Prev by Date: Re: Upload from a desktop app.
- Next by Date: Re: FindControl in FormView
- Previous by thread: Re: Parsing log file using C#
- Next by thread: try this..
- Index(es):
Relevant Pages
|