单机版日志处理完成
This commit is contained in:
39
.idea/workspace.xml
generated
39
.idea/workspace.xml
generated
@@ -2,11 +2,8 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="8ccbe0a5-cdf8-4091-a84b-916013277899" name="Default" comment="">
|
<list default="true" id="8ccbe0a5-cdf8-4091-a84b-916013277899" name="Default" comment="">
|
||||||
<change beforePath="" afterPath="$PROJECT_DIR$/.idea/libraries/Maven__com_kumkee_UserAgentParser_0_0_1.xml" />
|
|
||||||
<change beforePath="" afterPath="$PROJECT_DIR$/src/test/java/com/fjy/hadoop/UserAgentTest.java" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||||
<change beforePath="$PROJECT_DIR$/hadoopstudy.iml" afterPath="$PROJECT_DIR$/hadoopstudy.iml" />
|
<change beforePath="$PROJECT_DIR$/src/test/java/com/fjy/hadoop/UserAgentTest.java" afterPath="$PROJECT_DIR$/src/test/java/com/fjy/hadoop/UserAgentTest.java" />
|
||||||
<change beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml" />
|
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/out/" />
|
<ignored path="$PROJECT_DIR$/out/" />
|
||||||
<ignored path="$PROJECT_DIR$/target/" />
|
<ignored path="$PROJECT_DIR$/target/" />
|
||||||
@@ -32,10 +29,11 @@
|
|||||||
<file leaf-file-name="UserAgentTest.java" pinned="false" current-in-tab="true">
|
<file leaf-file-name="UserAgentTest.java" pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/src/test/java/com/fjy/hadoop/UserAgentTest.java">
|
<entry file="file://$PROJECT_DIR$/src/test/java/com/fjy/hadoop/UserAgentTest.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="152">
|
<state relative-caret-position="-629">
|
||||||
<caret line="21" column="23" lean-forward="true" selection-start-line="21" selection-start-column="23" selection-end-line="21" selection-end-column="23" />
|
<caret line="23" column="23" lean-forward="true" selection-start-line="23" selection-start-column="23" selection-end-line="23" selection-end-column="23" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
|
<element signature="e#790#807#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@@ -534,7 +532,7 @@
|
|||||||
<workItem from="1523931905005" duration="6215000" />
|
<workItem from="1523931905005" duration="6215000" />
|
||||||
<workItem from="1524056118416" duration="4576000" />
|
<workItem from="1524056118416" duration="4576000" />
|
||||||
<workItem from="1524146174789" duration="602000" />
|
<workItem from="1524146174789" duration="602000" />
|
||||||
<workItem from="1524196421728" duration="4649000" />
|
<workItem from="1524196421728" duration="4974000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="建立初始工程">
|
<task id="LOCAL-00001" summary="建立初始工程">
|
||||||
<created>1521904777876</created>
|
<created>1521904777876</created>
|
||||||
@@ -592,13 +590,17 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1524213651206</updated>
|
<updated>1524213651206</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="9" />
|
<task id="LOCAL-00009" summary="处理本地日志记录">
|
||||||
|
<created>1524214734524</created>
|
||||||
|
<option name="number" value="00009" />
|
||||||
|
<option name="presentableId" value="LOCAL-00009" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1524214734524</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="10" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TestHistory">
|
<component name="TestHistory">
|
||||||
<history-entry file="HDFSApp_copyFromLocalFileWithProgress - 2018.04.08 at 11h 28m 28s.xml">
|
|
||||||
<configuration name="HDFSApp.copyFromLocalFileWithProgress" configurationId="JUnit" />
|
|
||||||
</history-entry>
|
|
||||||
<history-entry file="HDFSApp_copyToLocalFile - 2018.04.08 at 12h 00m 17s.xml">
|
<history-entry file="HDFSApp_copyToLocalFile - 2018.04.08 at 12h 00m 17s.xml">
|
||||||
<configuration name="HDFSApp.copyToLocalFile" configurationId="JUnit" />
|
<configuration name="HDFSApp.copyToLocalFile" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
@@ -626,9 +628,12 @@
|
|||||||
<history-entry file="UserAgentTest_testReadFile - 2018.04.20 at 16h 58m 20s.xml">
|
<history-entry file="UserAgentTest_testReadFile - 2018.04.20 at 16h 58m 20s.xml">
|
||||||
<configuration name="UserAgentTest.testReadFile" configurationId="JUnit" />
|
<configuration name="UserAgentTest.testReadFile" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
|
<history-entry file="UserAgentTest_testReadFile - 2018.04.20 at 17h 03m 15s.xml">
|
||||||
|
<configuration name="UserAgentTest.testReadFile" configurationId="JUnit" />
|
||||||
|
</history-entry>
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="36834000" />
|
<option name="totallyTimeSpent" value="37159000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
|
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
|
||||||
@@ -644,7 +649,7 @@
|
|||||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||||
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32936078" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.31310943" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||||
@@ -678,7 +683,8 @@
|
|||||||
<MESSAGE value="工作前自动删除已有文件" />
|
<MESSAGE value="工作前自动删除已有文件" />
|
||||||
<MESSAGE value="使用Combiner加快处理效率" />
|
<MESSAGE value="使用Combiner加快处理效率" />
|
||||||
<MESSAGE value="使用Partitioner" />
|
<MESSAGE value="使用Partitioner" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="使用Partitioner" />
|
<MESSAGE value="处理本地日志记录" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="处理本地日志记录" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager />
|
<breakpoint-manager />
|
||||||
@@ -1162,10 +1168,11 @@
|
|||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/test/java/com/fjy/hadoop/UserAgentTest.java">
|
<entry file="file://$PROJECT_DIR$/src/test/java/com/fjy/hadoop/UserAgentTest.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="152">
|
<state relative-caret-position="-629">
|
||||||
<caret line="21" column="23" lean-forward="true" selection-start-line="21" selection-start-column="23" selection-end-line="21" selection-end-column="23" />
|
<caret line="23" column="23" lean-forward="true" selection-start-line="23" selection-start-column="23" selection-end-line="23" selection-end-column="23" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
|
<element signature="e#790#807#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import java.io.BufferedReader;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author F嘉阳
|
* @author F嘉阳
|
||||||
@@ -26,6 +28,8 @@ public class UserAgentTest {
|
|||||||
String line = "";
|
String line = "";
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
Map<String, Integer> browerMap = new HashMap<String, Integer>();
|
||||||
|
|
||||||
UserAgentParser userAgentParser = new UserAgentParser();
|
UserAgentParser userAgentParser = new UserAgentParser();
|
||||||
|
|
||||||
while (line != null) {
|
while (line != null) {
|
||||||
@@ -41,13 +45,23 @@ public class UserAgentTest {
|
|||||||
String os = agent.getOs();
|
String os = agent.getOs();
|
||||||
String platform = agent.getPlatform();
|
String platform = agent.getPlatform();
|
||||||
boolean mobile = agent.isMobile();
|
boolean mobile = agent.isMobile();
|
||||||
|
Integer browserValue = browerMap.get(browser);
|
||||||
|
if (browserValue != null) {
|
||||||
|
browerMap.put(browser, browerMap.get(browser) + 1);
|
||||||
|
} else {
|
||||||
|
browerMap.put(browser, 1);
|
||||||
|
}
|
||||||
|
|
||||||
//输出解析的信息
|
//输出解析的信息
|
||||||
System.out.println(browser + "," + engine + "," + engineVersion + "," + os + "," + platform + "," + mobile);
|
System.out.println(browser + "," + engine + "," + engineVersion + "," + os + "," + platform + "," + mobile);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
System.out.println("总记录数:"+count);
|
System.out.println("总记录数:" + count);
|
||||||
|
System.out.println("====================================");
|
||||||
|
for (Map.Entry<String,Integer>entry :browerMap.entrySet()){
|
||||||
|
System.out.println(entry.getKey()+":"+entry.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user