Hi. I have a website. I'm getting logs via syslog to my website.
I want to write a c++ code for, delete the logs after 30 days.
How can i do it?
I have no idea about it.
Thank you for your helps and ideas.
Hi everyone. Im thankful for all your answers.
I want to ask something too.
What if i want to use linux commands in my program.
I want to do it this operation with linux commands but i want to use c++ also.
you can use the dreaded system() function to invoke the command line. It is a risk, but very powerful for your own personal programs on your own personal computer. If you are releasing a tool for others, you can research safer methods. The risk is simply that a rogue executable file can be placed over the real program you invoke to do harm, letting your program call it with your creds (its easier to get a file on a box than to run it, so tricking the user into running it is sometimes a hacker strategy).
the more popular and widespread your tool is, the more of an issue that is. I have a dozen c++ programs that are glorified batch files doing the same thing. But I don't let them out to the public, either... it is a powerful technique, scripts and batch files have limitations that you can get around in c++, whether that avoids a large unwieldy and weird hack to work around a limit or enabling something you can't do at all.