Results 1 to 5 of 5

Thread: Web log file

  1. #1
    mariank is offline Member
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Default Web log file

    Hi,
    sorry for my bad English.

    I have a log file from a Web server with 120,000 lines.
    Example of input file:
    10.160.0.10;16.11.2011 12:56;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0"
    10.160.0.100;14.11.2011 7:22;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0"
    10.160.0.100;14.11.2011 10:45;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0"
    10.160.0.100;14.11.2011 10:53;/;-;"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)"

    I need to compare the IP address in the first line with IP in the second line
    and at the same time
    to compare the last box that contains the version of the web browser with version in the second line.
    And second line with third line etc.

    If first IP is same as second IP and together first version is same as second version
    then add to the end of line info example #1 (that will be mean that it is first user)

    If IP or version are different then add to the end of line #2 (second user).

    It identifies users based on IP address and User-Agent field (based on different versions of a web browser).

    Example of ouput file:
    10.160.0.10;16.11.2011 12:56;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0";#1
    10.160.0.100;14.11.2011 7:22;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0";#2
    10.160.0.100;14.11.2011 10:45;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0";#2
    10.160.0.100;14.11.2011 10:53;/;-;"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)";#3

    Do you have any idea how to do this?
    Which method to use?
    Thank you for help.
    Last edited by mariank; 11-01-2012 at 08:13 PM.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,037
    Rep Power
    10

    Default Re: Web log file

    Crossposted: Web log file
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default Re: Web log file

    Looks like a CSV which is using ';' as its separator.
    JCSV does this sort of thing quite easily, though you'll need to provide CSVStrategy since this is semi-colon separated. That'll break it up into the 4 sections (ip, timestamp, request, browser).
    Last edited by Tolls; 11-01-2012 at 03:54 PM. Reason: Add link to JCSV
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    mariank is offline Member
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Default Re: Web log file

    Can you write me some detail about it, I am newbie in programming.
    Thank you.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default Re: Web log file

    Not really, I've not used it.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 15
    Last Post: 02-16-2012, 04:43 PM
  2. Replies: 1
    Last Post: 07-28-2011, 08:50 PM
  3. Replies: 1
    Last Post: 08-04-2010, 04:24 PM
  4. Replies: 8
    Last Post: 02-18-2010, 01:54 PM
  5. Replies: 0
    Last Post: 02-11-2009, 10:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •