User identification and session identification are two major steps in preprocessing Web log data for Web usage mining. This paper introduces a fast active user-based user identification algorithm with time complexity O(n). The algorithm uses both an IP address and a finite users' inactive time to identify different users in the Web log. Web site ontology is useful for identifying Web site structure and break points for browsing behavior. For session identification, we present an ontology-based method that utilizes the Web site structure and functionalities to identify different sessions