| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3119 人关注过本帖
标题:如何提取日志文件中访问者的ip啊?
只看楼主 加入收藏
ykn
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-3-31
收藏
 问题点数:0 回复次数:1 
如何提取日志文件中访问者的ip啊?
#Software: Microsoft Internet Information Services 7.0
#Version: 1.0
#Date: 2016-03-03 00:00:02
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
2016-03-03 00:00:02 210.26.16.45 POST /jwmis/wap/MyXjda.aspx param=2ojocl2ncvff2jr8qw1meouc1osc671r67zo0028bw&param2=3c70a6a6f4ebc86f2c9004741ce0d30a 80 - 42.90.27.4 Dalvik/1.6.0+(Linux;+U;+Android+4.4.4;+Coolpad+Y1+Build/KTU84P) 200 0 0 265
2016-03-03 00:00:11 210.26.16.45 GET /jwmis/wap/loginverify_NODES.aspx param=2twnvn2sozbi1wj3ny1n07j31qkm7w1r66g71pdn722fmcgi2c0nfn1pzb8l1oshkn&param2=2ad343598b86ad2245ef503f2bc7ac02 80 - 42.90.19.5 Dalvik/1.6.0+(Linux;+U;+Android+4.4.4;+vivo+Y927+Build/KTU84P) 200 0 0 124
2016-03-03 00:00:11 210.26.16.45 POST /jwmis/wap/GetXnXqKsLc.aspx - 80 - 42.90.27.4 Dalvik/1.6.0+(Linux;+U;+Android+4.4.4;+Coolpad+Y1+Build/KTU84P) 200 0 0 327
2016-03-03 00:00:11 210.26.16.45 POST /jwmis/wap/getxnxq_kb.aspx - 80 - 42.90.19.5 Dalvik/1.6.0+(Linux;+U;+Android+4.4.4;+vivo+Y927+Build/KTU84P) 200 0 0 124
2016-03-03 00:00:12 210.26.16.45 POST /jwmis/wap/MyExamArrange.aspx - 80 - 42.90.27.0$0000576$100095-014$$dabjaggazqa3ahyaoqbxaheamwblag4azqb3adqazqbjadyacqa3agsacwboag4anaa&xq Dalvik/1.6.0+(Linux;+U;+Android+4.4.4;+Coolpad+Y1+Build/KTU84P) 200 0 0 468
2016-03-03 00:00:12 210.26.16.45 GET /jwmis/wap/mycourseschedule.aspx param=2vouum2s3afw1osg171mzw0e2kdfeh1x49af2splqg2kdhok1pz6lz1sd0451osjw11nln4w1ivcrr2tbbch20pddo2rj0jo2s4dun2rippj29nd8j1ghen52js5xn&param2=fb213f4e8c96b8f0fc76fbd8429534be 80 - 42.90.19.5 Dalvik/1.6.0+(Linux;+U;+Android+4.4.4;+vivo+Y927+Build/KTU84P) 200 0 0 514
2016-03-03 00:00:16 210.26.16.45 POST /jwmis/wap/GetXnXqKsLc.aspx - 80 - 42.90.19.5 Dalvik/1.6.0+(Linux;+U;+Android+4.4.4;+vivo+Y927+Build/KTU84P) 200 0 0 577
2016-03-03 00:00:16 210.26.16.45 POST /jwmis/wap/MyExamArrange.aspx - 80 - 42.90.19.5 Dalvik/1.6.0+(Linux;+U;+Android+4.4.4;+vivo+Y927+Build/KTU84P) 200 0 0 218
2016-03-03 00:00:17 210.26.16.45 POST /jwmis/wap/GetXnXqKsLc.aspx - 80 - 42.90.27.4 Dalvik/1.6.0+(Linux;+U;+Android+4.4.4;+Coolpad+Y1+Build/KTU84P) 200 0 0 639
2016-03-03 00:00:23 210.26.16.45 GET /jwmis/wap/mycourseschedule.aspx param=2uhy3g2qwdoq1nlja11lsz982j6inb1vxlqe2spuzd2ojl9d1vc31w1osg0x1o6y411nlj9z1nl6z82helq32atujd1fawk02j6soo2voxx11vcweg278l0n2m5nwh000036&param2=de894980b8a78140c4dddfb9cfa2691a 80 - 172.18.80.141 Dalvik/1.6.0+(Linux;+U;+Android+4.2.2;+HUAWEI+Y516-T00+Build/HUAWEIY516-T00) 200 0 0 156
2016-03-03 00:00:27 210.26.16.45 GET /jwmis - 80 - 117.156.14.209 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+Media+Center+PC+6.0;+.NET4.0C;+.NET4.0E) 301 0 0 109






代码怎么写啊?求大神帮忙
搜索更多相关主题的帖子: Microsoft Internet Software 访问者 Linux Microsoft Internet Software 访问者 Linux 
2016-03-31 12:35
ykn
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-3-31
收藏
得分:0 
package project;  
import *;  
public class ip3 {  
    public static void main(String[] args) throws Exception{  
        //生成模拟日志文件  
        LogAnalysis logAnalysis = new LogAnalysis();  
        File log = new File("D:\\javasoft\\TempTest\\BigData\\ip.txt");  
        log.createNewFile();  
        logAnalysis.creatLog(log, 10000);//节省时间  
         
        //分割日志文件  
        logAnalysis.splitLog(log, 1024);  
         
        //分析文件  
        File logSplits = new File("D:\\javasoft\\TempTest\\BigData\\logSplit");  
        for (File logSplit : logSplits.listFiles()) {  
            logAnalysis.analysis(logSplit);  
        }  
        for (ip3 o : logAnalysis.set) {  
            System.out.println(o.ip3+"---"+o.nums);  
        }  
    }  
}  
这段代码有什么错误没有?
2016-03-31 12:42
快速回复:如何提取日志文件中访问者的ip啊?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015870 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved