If you know the message ID of the message you are trying to find in History log, you can use the DSPLOG command with MSGID and you will only see Messages with that message ID. For example: DSPLOG MSGID(CPF0000) will display only messages starting with CPF as their message IDs.
Writing to History log:
Use the following command to write to the History log:
SNDMSG MSG('Message text') TOMSGQ(*HSTLOG)