Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Extraction
Forum Updated to NodeBB v4.3 + New Features

Extraction

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mittu
    wrote on last edited by
    #1

    Hi,
    How to extract and print the fields in following pattern: The fields are,date,time ip address,user agent cookies ,byte,refer etc(This is a log file)
    @
    [03/Dec/2013:10:53:59 +0000] - [32002 10.102.4.254 195.229.241.182 Up24RwpmBAwAAA1LWJsAAAAR GET /content/dam/original.jpg HTTP/1.1] _utmc=94539802; dtCookie=EFD9D09B6A2E1; dtPC=load; Carte::Kertdomain=6701c1320dd99722; UserData=Username:LSHARMA:Homepageg:0; etc etc....
    @
    Any one help me? Which method is used for this application?

    [edit, code tags, koahnig]

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      A good start would be "QString::split functionality.":http://qt-project.org/doc/qt-5/qstring.html#split When used with ';' as separator you will already split into the major section pieces as it looks. A more advanced method would be using the variations with "QRegExp":http://qt-project.org/doc/qt-5/qregexp.html or the new "QRegularExpression":http://qt-project.org/doc/qt-5/qregularexpression.html . However, this depends a bit on how much automation and sophistication you like to have.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mittu
        wrote on last edited by
        #3

        Thank you...
        This is only one type of log.About my project log analysis(It analyze different types of log).The QRegExp is easy method or not in my project?i go through the QRegExp.But the project time is very short and also am new in Qt.So Can you split the above log file?If you split the above log file i can get the clear idea and i will follow the same method in other log file case.
        So can you help me?

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          It is a philosophic discussion whether regular expressions are easy to use or not.
          If you have never done anything with regular expressions and you have to do your job quickly, I would not recommend regular expressions. It is certainly something to get used to.
          Regular expressions are very powerful, but a bit complex. Anyway for regular expressions there is an "example":http://qt-project.org/doc/qt-5/qtwidgets-tools-regexp-example.html given. I found it quite useful for testing my regular expressions with an example line.
          Good luck

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mittu
            wrote on last edited by
            #5

            Thanks....

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved