The proof of origin of logs is becoming increasingly important. In the context of Industry 4.0 and to combat illegal logging there is an increasing motivation to track each individual log. Our previous works in this field focused on log tracking using digital log end images based on methods inspired by fingerprint and iris-recognition. This work presents a convolutional neural network (CNN) based approach which comprises a CNN-based segmentation of the log end combined with a final CNN-based recognition of the segmented log end using the triplet loss function for CNN training. Results show that the proposed two-stage CNN-based approach outperforms traditional approaches.