collect logs from bash each 24 hours [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1















my idea is to collect logs each 24 hours ,mail it
and flush them after that



i wrote some scatch
for example
1.var/log/auth



some info
2.var/log/something.log
some info



list="$(find /var/log -name *.log )"
for file in $list;do
echo '#############################'
onehourago=$(date --date='1 hours ago' +"%b%e %H:%M:%S")
echo $onehourago | cat $file - |sort| sed "1,/$onehourago/d"
done


but still could not understand the problem










share|improve this question















closed as unclear what you're asking by Fabby, Rui F Ribeiro, Sparhawk, G-Man, Stephen Harris Jan 19 at 3:37


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 2





    What’s your question?

    – Peschke
    Jan 18 at 22:37











  • i cant make a proper list as i want it just a big list without delimeter

    – staz
    Jan 18 at 22:39















1















my idea is to collect logs each 24 hours ,mail it
and flush them after that



i wrote some scatch
for example
1.var/log/auth



some info
2.var/log/something.log
some info



list="$(find /var/log -name *.log )"
for file in $list;do
echo '#############################'
onehourago=$(date --date='1 hours ago' +"%b%e %H:%M:%S")
echo $onehourago | cat $file - |sort| sed "1,/$onehourago/d"
done


but still could not understand the problem










share|improve this question















closed as unclear what you're asking by Fabby, Rui F Ribeiro, Sparhawk, G-Man, Stephen Harris Jan 19 at 3:37


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 2





    What’s your question?

    – Peschke
    Jan 18 at 22:37











  • i cant make a proper list as i want it just a big list without delimeter

    – staz
    Jan 18 at 22:39













1












1








1








my idea is to collect logs each 24 hours ,mail it
and flush them after that



i wrote some scatch
for example
1.var/log/auth



some info
2.var/log/something.log
some info



list="$(find /var/log -name *.log )"
for file in $list;do
echo '#############################'
onehourago=$(date --date='1 hours ago' +"%b%e %H:%M:%S")
echo $onehourago | cat $file - |sort| sed "1,/$onehourago/d"
done


but still could not understand the problem










share|improve this question
















my idea is to collect logs each 24 hours ,mail it
and flush them after that



i wrote some scatch
for example
1.var/log/auth



some info
2.var/log/something.log
some info



list="$(find /var/log -name *.log )"
for file in $list;do
echo '#############################'
onehourago=$(date --date='1 hours ago' +"%b%e %H:%M:%S")
echo $onehourago | cat $file - |sort| sed "1,/$onehourago/d"
done


but still could not understand the problem







bash sed date sort






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 at 23:26









Rui F Ribeiro

39.9k1479134




39.9k1479134










asked Jan 18 at 22:34









stazstaz

62




62




closed as unclear what you're asking by Fabby, Rui F Ribeiro, Sparhawk, G-Man, Stephen Harris Jan 19 at 3:37


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by Fabby, Rui F Ribeiro, Sparhawk, G-Man, Stephen Harris Jan 19 at 3:37


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 2





    What’s your question?

    – Peschke
    Jan 18 at 22:37











  • i cant make a proper list as i want it just a big list without delimeter

    – staz
    Jan 18 at 22:39












  • 2





    What’s your question?

    – Peschke
    Jan 18 at 22:37











  • i cant make a proper list as i want it just a big list without delimeter

    – staz
    Jan 18 at 22:39







2




2





What’s your question?

– Peschke
Jan 18 at 22:37





What’s your question?

– Peschke
Jan 18 at 22:37













i cant make a proper list as i want it just a big list without delimeter

– staz
Jan 18 at 22:39





i cant make a proper list as i want it just a big list without delimeter

– staz
Jan 18 at 22:39










1 Answer
1






active

oldest

votes


















0














Why aren't you using [logrotate]?1 It even has an option to mail the log to you.






share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Why aren't you using [logrotate]?1 It even has an option to mail the log to you.






    share|improve this answer



























      0














      Why aren't you using [logrotate]?1 It even has an option to mail the log to you.






      share|improve this answer

























        0












        0








        0







        Why aren't you using [logrotate]?1 It even has an option to mail the log to you.






        share|improve this answer













        Why aren't you using [logrotate]?1 It even has an option to mail the log to you.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 18 at 23:56









        GarnetGarnet

        263




        263












            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?