Results 1 to 22 of 22

Thread: Search Log [RESOLVED]

  1. #1

    Thread Starter
    Hyperactive Member alacritous's Avatar
    Join Date
    Aug 2003
    Posts
    464

    Resolved Search Log [RESOLVED]

    Hello,
    I run a web server, on my server, and there is a log file that logs all the actions that occur. Well, there is tons of different actions per ip address. I want to filter out the whole log file and get the ips, but not showing the same ip twice, so there is a clear list with all the ips. I just need to know a good method, as I know the string commands.

    alacritous
    Last edited by alacritous; Sep 22nd, 2004 at 08:49 PM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    One way would be to load all the ip addresses into a temp table
    and then run a DISTINCT query and insert the query results into
    a final table. Delete the temp table and you are left with a table
    of distinct ip addresses.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Hyperactive Member alacritous's Avatar
    Join Date
    Aug 2003
    Posts
    464
    How would I even find the IPs? I think it starts with one on each line. If it does, then it will be easy. I'll have to show you some of it, sorry I didn't earlier.

    It'll be in a little while until I can show you, sorry.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    You should be able to parse the ips out of each line in the log file.
    You just need to find something that can be used to designate
    the start and end of an ip address. You can use Left, Mid, and
    Len to parse it out.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    Why do you want to know the IP addresses of anybody?
    As long as nothing bad has happened, you should just forget about them.

  6. #6
    Frenzied Member ice_531's Avatar
    Join Date
    Aug 2002
    Location
    Sitting w/ Bob Status: -Next -To- Null- Friend: Philip
    Posts
    1,152
    Originally posted by dglienna
    Why do you want to know the IP addresses of anybody?
    As long as nothing bad has happened, you should just forget about them.
    To start his own world domination scheme like VBD (see chitchat for further information)

    Maybe he wants the file to be neater? (log file that is) if it happens to be jumbled up together with ip:action:time:action:action:anotherip:action:anotherip2: ......get the point?


    But yes you can use the string functions Robdog posted... or could even use the split function using a delimiter depending on what all is in the log file. please post an example with fake ips though.

    ice
    :::`DISCLAIMER`:::
    Do NOT take anything i have posted to be truthful in any way, shape or form.
    Thank You!

    --------------------------------
    "Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
    "Finaly I can look as gay as I want..." - NoteMe
    Languages: VB6, BASIC, Java, C#. C++

  7. #7

    Thread Starter
    Hyperactive Member alacritous's Avatar
    Join Date
    Aug 2003
    Posts
    464
    I run a webserver, and the statistics don't give a great deal of information. It says how many times ANYONE has visited ANY html page. That also goes for the images and stuff. I would like to know the exact amount of people, and I could, yes, either use a free counter, but I'd rather create my own which would also give more detail.

    I am really busy at the moment, but yeah, I figured the len, right, left, mid, all that stuff would work, so I'll just use that and find the end of the ip somehow.

    alacritous
    Last edited by alacritous; Aug 3rd, 2004 at 12:37 PM.

  8. #8

    Thread Starter
    Hyperactive Member alacritous's Avatar
    Join Date
    Aug 2003
    Posts
    464
    Hello,
    Sorry, I've been busy for a while. I have filtered out all the IPs, but there are doubles. How can I get rid of the doubles? BTW, it's so big of a file, I had to split it 4 times. But even then, each file is 6,000 lines + so keep that in mind.

    Thanks,
    alacritous

  9. #9
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    import them into access, making them a key
    this will sort them as well

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Or after they are imported into Access, do a SELECT DISTINCT
    query and then insert those records into another table. Then
    cleanup by deleting the initial table's records.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11

    Thread Starter
    Hyperactive Member alacritous's Avatar
    Join Date
    Aug 2003
    Posts
    464
    ...

    code

  12. #12

    Thread Starter
    Hyperactive Member alacritous's Avatar
    Join Date
    Aug 2003
    Posts
    464
    anyone?

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Sorry for the delay.
    After you import all the records into the TableTemp using ADO or
    whatever, run these two queries.

    Code:
    INSERT INTO 
     IPVisitors (
      IPAddress,
      Field2,
      Field3)
     SELECT DISTINCT
      IPAddress,
      Field2,
      Field3 
     FROM
      TableTemp
     ORDER BY
      IPAddress ASC;
    Code:
    DELETE * FROM TableTemp;
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Hyperactive Member alacritous's Avatar
    Join Date
    Aug 2003
    Posts
    464
    Odd...

    I didn't ask for it using access... Maybe I should have specified it better before...

    all code please!

    alacritous

    edit: i know this has nothing to do with this, but I was hoping if someone knew why when I install microsoft office XP it hangs up on the file (sry cant get it right now) something like OWSCLT.DLL and doesn't install.

    last time when I reformatted, once I installed winXP service pack it worked, but obviously its not now...

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Sorry, but I dont have allot of time to write the program for you.
    I need to finish a program for a client. Needs to be under budget.

    If you are unsure of how to connect to and insert records into
    access then perhaps a search or another thread in the
    databases forum. Maybe try first and others will help if you get
    stuck.

    The queries I gave you will work for either Access or SQL.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16

    Thread Starter
    Hyperactive Member alacritous's Avatar
    Join Date
    Aug 2003
    Posts
    464
    Originally posted by RobDog888
    Sorry, but I dont have allot of time to write the program for you.
    I need to finish a program for a client. Needs to be under budget.

    If you are unsure of how to connect to and insert records into
    access then perhaps a search or another thread in the
    databases forum. Maybe try first and others will help if you get
    stuck.

    The queries I gave you will work for either Access or SQL.

    ***? Am I speaking?
    I know how to do that. Who said I was going to do it that way? I said CODE not records...

    I never said to write code for me. I asked how to get rid of doubles. For instance:

    It would make:
    ip1
    ip1
    ip2
    ip3
    ip4
    ip4

    Into:
    ip1
    ip2
    ip3
    ip4

    alacritous

  17. #17
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    And he did give you a solution by dumping the info into a database so you can use SQL to filter out the records you need and transfer them to another table. You can then read of the unique IP addresses off the second table.

    Either use that or filter the info manually through an nested iteration of an array or collection.

  18. #18

    Thread Starter
    Hyperactive Member alacritous's Avatar
    Join Date
    Aug 2003
    Posts
    464
    Like I said, and I'll say it again which I will probably have to even more. I DO NOT want to dump it.

    How would I do it with the array thing?

    alacritous

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    If you dont want to dump it the take the subquery and make it a
    permenant query in Access. Then you can use it as the source
    for a report. The report will show all ips and no dups. Still
    retaining the entire table. No dumping. Dude, I don't appreciate
    the 'tude. After all we are helping you for free. I should stop
    myself here, so I will.


    Import all records into table Table1. Then make this a query and
    set it as the recordsource for an Access report.

    Done!

    Code:
     SELECT DISTINCT
      IPAddress,
      Field2,
      Field3 
     FROM
      Table1
     ORDER BY
      IPAddress ASC;
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  20. #20
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    Use a collection

    VB Code:
    1. On Error Resume Next
    2.    For/Do/While iteration through all IP addresses
    3.       strIPAddress = An IP from source structure
    4.       colTemp.Add strIPAddress, strIPAddress
    5.       If Err Then Err.Clear  'catch error produced with duplicate key hence duplicate IP
    6.    Next/Loop/Wend
    7. On Error Goto 0

    Resulting collection will be one copy of each IP.

    If dont want to iterate throug the struct (eg direct InStr from the file) you can make the collection module level and create an add functiuon(strIP As String) with the error trapping so you don't have to recode the error trap.
    Last edited by leinad31; Aug 6th, 2004 at 10:57 PM.

  21. #21

    Thread Starter
    Hyperactive Member alacritous's Avatar
    Join Date
    Aug 2003
    Posts
    464
    RobDog888, I don't need people helping me that can't read what I say. Thank you thus far, though.

    leinad31, thank you so much. This is perfect!

    Thanks!
    alacritous

  22. #22
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Your welcome, although like you say can't read. Then you should
    have been able to read the previous posts to see that the
    solution was posted there.

    Don't worry, I will not help you again.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width