Retrieve chat history

Hello
I am new to openfire please help to retrieve one to one chat history.
I am using openfire 4.2.1 on ubuntu 16.04.

Do you have Monitoring Service plugin installed?

Yes, i have installed it but i need store chat in logs file and retrieve it from logs file.

You can enable Audit logs and it will logs chats into /openfire/logs/ (Server > Server Settings > Message Audit Policy). But these logs are in xml format, not read friendly. You can try using this app to view them Openfire Audit Log Reader

is it store chat-wise or user wise history ?

As far as i remember it just records every message as they appear on server, so it is neither of that.