In the paper an on-line analysis system using Near-infrared spectroscopy technology is presented ,which is applied to fulfill real time measurement of the amount of components in down2hole fluid ,such as crude oil ,water and drilling mud ,in a logging instrument for midway exploration of oil layers. In the analysis system ,a group of narrowband filters are used ,whose center wavelengths correspond to characteristic absorbing peaks of measured matter.This gives the analysis system a small size and a compact structure. Also near-infrared spectroscopy of a group of crude oil mixture samples is measured ,the amount of whose components is known. Linear regression models that were set up show that the correlation of the model using several wavelengths is equivalent to that of the model using all wavelengths. This proves the feasibility of this on-line analysis system.