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 8642669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:50:06+00:00 2026-06-12T11:50:06+00:00

i try to create a filter to a large log file like Fri Oct

  • 0

i try to create a filter to a large log file like

Fri Oct  5 00:55:45 2012 [pid 2766] CONNECT: Client "157.82.250.217"
Fri Oct  5 00:55:45 2012 [pid 2765] [ftp] OK LOGIN: Client "157.82.250.217", anon password "mozilla@example.com"
Fri Oct  5 00:56:05 2012 [pid 2767] [ftp] FAIL DOWNLOAD: Client "157.82.250.217", "/pub/10.5524/100001_101000/100036/Gene_catalogue/Gene_catalogue.pep", 1638400 bytes, 81.81Kbyte/sec
Fri Oct  5 00:57:27 2012 [pid 3056] CONNECT: Client "157.82.250.217"
Fri Oct  5 00:57:27 2012 [pid 3055] [ftp] OK LOGIN: Client "157.82.250.217", anon password "-wget@"

I want to put the ip address in to http://www.ip-adress.com to get the organization name
like 157.82.250.217 –> University of Tokyo then add University of Tokyo behind ip address

The website is http://www.ip-adress.com/ip_tracer/157.XX.xxx.xx
and the source code like :

    <th>ISP of this IP [<a href="/isp" target="_self">?</a>]:</th>

    <td>

      University of Tokyo</td>

    </tr>

  <tr class="odd">

  <th>Organization:</th>

 <td>

  University of Tokyo</td>

  </tr>

  <tr class="even">

I’m newcomer in python, i write some for filter time, and can you help me add function inside

import time
f= open("/opt/CLiMB/Storage1/log/vsftp.log")
def OnlyRecent(line):
if  time.strptime(line.split("[")[0].strip(),"%a %b %d %H:%M:%S %Y")>  time.gmtime(time.time()-(60*60*24*7)): 
    return True
return False
filename= time.strftime('%Y%m%d')+'.log'
f1= open(filename,'w')
for line in f:
if OnlyRecent(line):
        print line
        f1.write(line)
f.close()
f1.close()

Thanks!!

  • 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-12T11:50:08+00:00Added an answer on June 12, 2026 at 11:50 am

    I (usually nobody at StackOverflow) will write your code. Have a look at http://docs.python.org/library/urllib2.html. Build your url, pass it to urllib2.urlopen and read the result into a string. Then extract the data you want to have. That’s it!

    In your case simple string operations should be enough to extract the data, but you could also check http://www.crummy.com/software/BeautifulSoup/.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try using python create filter for log file like Thu Oct 4 23:14:40
I want to try create something like Zend's Server Pagecache. What I want to
I try to create a new file inside a JSP and try to save
I'm using the proprietry MS 'filter' property to try and create a non ugly
I'd like to create a filter which allows almost all chars but without /
I try to create some linq query like following. I have a table with
hello i have the following problem: i would like to create a filter for
I try create a map for open ~/.vimrc, but open the ~/.vimrc only when
I try to create donate via PayPal button and add custom select with amount.
I try to create styles with first-child and last-child items but I encountered a

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.