Fault diagnosis and prognosis play important roles in the community of discrete event systems (DESs) and have garnered significant interest from researchers. Despite their close relationship, these concepts are typically formalized and studied independently. This paper introduces a novel concept, known as feature recognition of DESs, which unifies fault diagnosis and prognosis into one framework based on ω-language. For any infinite faulty ω-string, feature string is defined as its some finite prefix by which the faulty behavior can be distinguished from all normal language, and fault diagnosis and prognosis can be decided by the type of feature strings (normal or faulty). Then the problem of feature recognizability is converted to verify the existence of feature strings with respect to every faulty ω-string. Compared with fault diagnosis and prognosis, the notion of feature recognition is more general because it relaxes the restriction of uniformity on reaction bound and helps to understand the essence of fault diagnosis and prognosis more intuitively. More importantly, online recognition algorithms can be designed straightforward according to the definition of feature recognition and online decision can be realized as soon as possible. A necessary and sufficient condition for verifying feature recognizability is concluded and an online recognizer that meets timeliness condition is also constructed to execute fault diagnosis and prognosis synchronously.