Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7704089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:36:24+00:00 2026-05-31T23:36:24+00:00

I am working an a section of application which needs to Parse CSV Logs

  • 0

I am working an a section of application which needs to Parse CSV Logs generated by PostgreSql server.

  • The Logs are stored C:\Program Files\PostgreSQL\9.0\data\pg_log

  • The Server version in 9.0.4

  • The application is developed in C Sharp

    • The basic utility after Parse the Log is to show contents in a DataGridView.
    • There are other filter options like to view log contents for a particular range of Time for a Day.

However the main problem that is, the Log format is not readable

It was first tested with A Fast CSV Reader

  • Parsing CSV files in C#, with header
  • http://www.codeproject.com/KB/database/CsvReader.aspx

Then we made a custom utility using String.Split method with the usual Foreach loop going through the array

A Sample Log data line

2012-03-21 11:59:20.640 IST,”postgres”,”stock_apals”,3276,”localhost:1639″,4f697540.ccc,10,”idle”,2012-03-21 11:59:20 IST,2/163,0,LOG,00000,”statement: SELECT id,pdate,itemname,qty from stock_apals order by pdate,id”,,,,,,,,”exec_simple_query, .\src\backend\tcop\postgres.c:900″,””

As you can see the columns in the Log are comma separated , But however individual values
are not Quote Enclosed.

For instance the 1st,4rth,6th .. columns

Is there a utility or a Regex that can find malformed columns and place quotes

This is especially with respect to performace, becuase these Logs are very long and
new ones are made almost every hour

I just want to update the columns and use the FastCSVReader to parse it.

Thanks for any advice and help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:36:25+00:00Added an answer on May 31, 2026 at 11:36 pm

    I’ve updated my csv parser, so it’s now able to parse you data (at least provided in example). Below is exampe console app which is parsing your data saved in multiline_quotes.txt file. Project source can be found here (you can download a ZIP). You need either Gorgon.Parsing or Gorgon.Parsing.Net35 (in case you can’t use .NET 4.0).

    Actually I was able to achive same result using Fast CSV Reader. You just used it some wrong way in the first place.

    namespace So9817628
    {
        using System.Data;
        using System.Text;
        using Gorgon.Parsing.Csv;
    
        class Program
        {
            static void Main(string[] args)
            {
                // prepare
                CsvParserSettings s = new CsvParserSettings();
                s.CodePage = Encoding.Default;
                s.ContainsHeader = false;
                s.SplitString = ",";
                s.EscapeString = "\"\"";
                s.ContainsQuotes = true;
                s.ContainsMultilineValues = true;
                // uncomment below if you don't want escape quotes ("") to be replaced with single quote
                //s.ReplaceEscapeString = false;
    
                CsvParser parser = new CsvParser(s);
    
                DataTable dt = parser.ParseToDataTableSequential("multiline_quotes.txt");
    
                dt.WriteXml("parsed.xml");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a questionnaire type application in which questions are stored in a
I am working on an application in which data is displaying from back end
i am working on a section of a project, that parses Logs from Postgres
I'm working with the google maps API, and testing a section which geocodes all
I need your help :( I'm working on a iOS application in which i
I'm currently working on an application which keeps tracks of cats and their associated
I am working on a project for a client which needs an automatic login
I'm working on a program that needs to be able to load object-properties from
I am working on a backbone.js application with rails api which provides the json
Im writing a server application for my iPhone app. The section of the server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.