Score:1

How to append content of one file to another in Linux continuesly?

ax flag

I have a log file log.log that is created by the application, I want to have any new line added to this file continuously being added to another log file historical_log.log. How can I do that? I am using RHL7 at the moment.

Thank you

Romeo Ninov avatar
in flag
If you have your app sent long to STDOUT you can try something like: `application|tee -a historical_log.log >log.log`
Behnamkvl avatar
ax flag
Thank you for the answer, unfortunately, I do not have access to the app code so I cannot modify how the log.log file is created.
Score:1
id flag

This would do what you want, I think:

tail -F log.log >>historical_log.log &

It's quick and dirty, but might be enough on it's own, or wrapped in a script.

Behnamkvl avatar
ax flag
Thank you, it was helpful, I think this process needs to be running as when I am closing the terminal it stops doing the job. So far I ended up running a cron to append the lines.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.