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

  • SEARCH
  • Home
  • 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 8211797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:33:07+00:00 2026-06-07T10:33:07+00:00

I am looking to parse log files (text files usually delimited by certain characters),

  • 0

I am looking to parse log files (text files usually delimited by certain characters), and I want to make the job easier by making a parser that can take in an xml file which describes the format of the log file coming in. This way I can feed my parser any type of log file and with my xml description my parser and extract the useful information. I am not sure how to generically describe the log file format in xml. Also I am unsure about how to then match lines in my log file with the descriptions given. I would greatly appreciate any help and guidance on this. Thank you very much to anyone who replies.

  • 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-06-07T10:33:10+00:00Added an answer on June 7, 2026 at 10:33 am
    <logfile location="/usr/local/logs/logfile.log">
        <delimiter>#</delimiter>
        <format>
            <field index="1" length="10">
                <target>Date</target>
            </field>
            <field index="2">
                <target>Message</target>
            </field>
            <field index="3" length="20">
                <target>Component</target>
            </field>
            <field index="5" length="20">
                <target>Details</target>
            </field>
        </format>
    </logfile>
    

    Your code will read this XML and parse each line in the log file dynamically according to the rules defined here. The program will then store the values in appropriate ‘target’ fields.

    log file:

    2012/12/12 10.10.10#Critical application state#Error in component XYZ#Useless information#Useful information
    

    Output:

    Date: 2012/12/12
    Message: Critical application state
    Component: Error in component XYZ
    Details: Useful information
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I have a number of scripts that parse log files looking for hex
We're looking for a way to parse large amounts of XML files that conform
I'm looking for a library/framework to generate/parse TXT files from/into Java objects. I'm thinking
I want to parse the output from git log. My current tool does this
I'm currently working on a parser for our internal log files (generated by log4php,
I'm looking to parse UTF8 characters from the standard output stream of another application
I'm looking at different options for storing log entries for easier querying/reporting. Currently I
I have a set of days of log files that I need to parse
I'm looking to parse some CXML in PHP...basically all I'm looking to get the
I'm looking to parse an xhtml document with Microsoft.XMLHTTP with XPATH in VBScript. I

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.