Wireless sensor network (WSN) models pose substantial security vulnerabilities since most WSNs are deployed in unattended hostile environments. This research focuses on denial-of-service (DoS) attack detection, a crucial problem in WSN security. Previous research has mostly focused on offline machine learning algorithms, which require long-term data collection and cannot continually adapt to new data. Online learning is thus more suitable for detecting DoS attacks in WSN due to the benefit of continuous improvement with fresh data. Nevertheless, existing online DoS attack detection algorithms do not take internal and external data interference into consideration. Thus, noisy data might have a negative effect on the performance of the model. Moreover, the data includes features that are redundant or unnecessary for the classification. Hence, the selection of proper features not only decreases computational time but also improves the performance of the model. This study proposes an online-learning-based approach for detecting DoS attacks in WSN. Specifically, a feature selection method is proposed to identify the most appropriate attributes for the training process. Furthermore, a noise-tolerant online passive-aggressive multi-class classifier is also developed. The performance of our proposed method is investigated in terms of accuracy, precision, recall, and F1-score, and it proves to be competitive.