/var/log/account/pacct is getting too big, where is ckpacct (to cicle/gzip it)?












3















I got 2 big files at, /var/log/account, of 350MB each..., my root is only 10GB...



I read there could have ckpacct to cycle and gzip it, but I cant find it, also no alternative command?



EDIT: I found that sudo accton off disable the logging but the files remain there, and I guess my next boot it will be activated again...



They seem to are being cycled but who actually does it?



369114432 May 13 23:23 /var/log/account/pacct
333708160 May 13 12:27 /var/log/account/pacct.0
13681065 May 12 16:21 /var/log/account/pacct.1.gz
3371433 May 11 09:50 /var/log/account/pacct.2.gz
7549333 May 10 07:35 /var/log/account/pacct.3.gz


EDIT: my guess boot scripts does the cycle... anyway, I created this script, but I dont know what safety implications it may have.. any considerations?



cat >ckpacct.sh



#!/bin/bash

if [[ -n "$1" ]]; then
echo "there is no parameters and no --help, read the script and understand what is does, before running it up."
exit 1
fi

if [[ "$USER" != "root" ]]; then
echo "you must be root to run it..."
exit 1
fi

function FUNCerror() {
if(($1!=0));then exit 1; fi
}

cd /var/log/account;FUNCerror $? || exit

# fast ungrab pacct file
accton off;FUNCerror $?

mv -v pacct pacct.0.temp;FUNCerror $?

echo -n |tee pacct;FUNCerror $?
chown -v root:adm pacct;FUNCerror $?
chmod -v o-r pacct;FUNCerror $?

accton on;FUNCerror $?

# compress old 0
gzip -v --best pacct.0;FUNCerror $? #releases also pacct.0 filename

mv -v pacct.0.temp pacct.0;FUNCerror $? #restore new 0 from temp

# change file names upping indexes
#mv -v pacct pacct.0
for((i=4;i>=0;i--));do
mv -v pacct.$i.gz pacct.$((i+1)).gz;FUNCerror $?
done
rm -v pacct.5.gz;FUNCerror $? # remove last in the limit









share|improve this question





























    3















    I got 2 big files at, /var/log/account, of 350MB each..., my root is only 10GB...



    I read there could have ckpacct to cycle and gzip it, but I cant find it, also no alternative command?



    EDIT: I found that sudo accton off disable the logging but the files remain there, and I guess my next boot it will be activated again...



    They seem to are being cycled but who actually does it?



    369114432 May 13 23:23 /var/log/account/pacct
    333708160 May 13 12:27 /var/log/account/pacct.0
    13681065 May 12 16:21 /var/log/account/pacct.1.gz
    3371433 May 11 09:50 /var/log/account/pacct.2.gz
    7549333 May 10 07:35 /var/log/account/pacct.3.gz


    EDIT: my guess boot scripts does the cycle... anyway, I created this script, but I dont know what safety implications it may have.. any considerations?



    cat >ckpacct.sh



    #!/bin/bash

    if [[ -n "$1" ]]; then
    echo "there is no parameters and no --help, read the script and understand what is does, before running it up."
    exit 1
    fi

    if [[ "$USER" != "root" ]]; then
    echo "you must be root to run it..."
    exit 1
    fi

    function FUNCerror() {
    if(($1!=0));then exit 1; fi
    }

    cd /var/log/account;FUNCerror $? || exit

    # fast ungrab pacct file
    accton off;FUNCerror $?

    mv -v pacct pacct.0.temp;FUNCerror $?

    echo -n |tee pacct;FUNCerror $?
    chown -v root:adm pacct;FUNCerror $?
    chmod -v o-r pacct;FUNCerror $?

    accton on;FUNCerror $?

    # compress old 0
    gzip -v --best pacct.0;FUNCerror $? #releases also pacct.0 filename

    mv -v pacct.0.temp pacct.0;FUNCerror $? #restore new 0 from temp

    # change file names upping indexes
    #mv -v pacct pacct.0
    for((i=4;i>=0;i--));do
    mv -v pacct.$i.gz pacct.$((i+1)).gz;FUNCerror $?
    done
    rm -v pacct.5.gz;FUNCerror $? # remove last in the limit









    share|improve this question



























      3












      3








      3


      1






      I got 2 big files at, /var/log/account, of 350MB each..., my root is only 10GB...



      I read there could have ckpacct to cycle and gzip it, but I cant find it, also no alternative command?



      EDIT: I found that sudo accton off disable the logging but the files remain there, and I guess my next boot it will be activated again...



      They seem to are being cycled but who actually does it?



      369114432 May 13 23:23 /var/log/account/pacct
      333708160 May 13 12:27 /var/log/account/pacct.0
      13681065 May 12 16:21 /var/log/account/pacct.1.gz
      3371433 May 11 09:50 /var/log/account/pacct.2.gz
      7549333 May 10 07:35 /var/log/account/pacct.3.gz


      EDIT: my guess boot scripts does the cycle... anyway, I created this script, but I dont know what safety implications it may have.. any considerations?



      cat >ckpacct.sh



      #!/bin/bash

      if [[ -n "$1" ]]; then
      echo "there is no parameters and no --help, read the script and understand what is does, before running it up."
      exit 1
      fi

      if [[ "$USER" != "root" ]]; then
      echo "you must be root to run it..."
      exit 1
      fi

      function FUNCerror() {
      if(($1!=0));then exit 1; fi
      }

      cd /var/log/account;FUNCerror $? || exit

      # fast ungrab pacct file
      accton off;FUNCerror $?

      mv -v pacct pacct.0.temp;FUNCerror $?

      echo -n |tee pacct;FUNCerror $?
      chown -v root:adm pacct;FUNCerror $?
      chmod -v o-r pacct;FUNCerror $?

      accton on;FUNCerror $?

      # compress old 0
      gzip -v --best pacct.0;FUNCerror $? #releases also pacct.0 filename

      mv -v pacct.0.temp pacct.0;FUNCerror $? #restore new 0 from temp

      # change file names upping indexes
      #mv -v pacct pacct.0
      for((i=4;i>=0;i--));do
      mv -v pacct.$i.gz pacct.$((i+1)).gz;FUNCerror $?
      done
      rm -v pacct.5.gz;FUNCerror $? # remove last in the limit









      share|improve this question
















      I got 2 big files at, /var/log/account, of 350MB each..., my root is only 10GB...



      I read there could have ckpacct to cycle and gzip it, but I cant find it, also no alternative command?



      EDIT: I found that sudo accton off disable the logging but the files remain there, and I guess my next boot it will be activated again...



      They seem to are being cycled but who actually does it?



      369114432 May 13 23:23 /var/log/account/pacct
      333708160 May 13 12:27 /var/log/account/pacct.0
      13681065 May 12 16:21 /var/log/account/pacct.1.gz
      3371433 May 11 09:50 /var/log/account/pacct.2.gz
      7549333 May 10 07:35 /var/log/account/pacct.3.gz


      EDIT: my guess boot scripts does the cycle... anyway, I created this script, but I dont know what safety implications it may have.. any considerations?



      cat >ckpacct.sh



      #!/bin/bash

      if [[ -n "$1" ]]; then
      echo "there is no parameters and no --help, read the script and understand what is does, before running it up."
      exit 1
      fi

      if [[ "$USER" != "root" ]]; then
      echo "you must be root to run it..."
      exit 1
      fi

      function FUNCerror() {
      if(($1!=0));then exit 1; fi
      }

      cd /var/log/account;FUNCerror $? || exit

      # fast ungrab pacct file
      accton off;FUNCerror $?

      mv -v pacct pacct.0.temp;FUNCerror $?

      echo -n |tee pacct;FUNCerror $?
      chown -v root:adm pacct;FUNCerror $?
      chmod -v o-r pacct;FUNCerror $?

      accton on;FUNCerror $?

      # compress old 0
      gzip -v --best pacct.0;FUNCerror $? #releases also pacct.0 filename

      mv -v pacct.0.temp pacct.0;FUNCerror $? #restore new 0 from temp

      # change file names upping indexes
      #mv -v pacct pacct.0
      for((i=4;i>=0;i--));do
      mv -v pacct.$i.gz pacct.$((i+1)).gz;FUNCerror $?
      done
      rm -v pacct.5.gz;FUNCerror $? # remove last in the limit






      disk-usage






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago









      Pablo Bianchi

      2,71821532




      2,71821532










      asked May 14 '13 at 2:15









      Aquarius PowerAquarius Power

      1,70322142




      1,70322142






















          3 Answers
          3






          active

          oldest

          votes


















          1














          The script that cycles the logs is in /etc/cron.daily/acct. The number of log files is controlled by /etc/default/acct, which also controls whether process accounting should be enabled at boot time.



          If you want to entirely remove process accounting, sudo apt-get purge acct should do the trick too.






          share|improve this answer
























          • With systemd you can also use systemctl to just stop and/or disable acct.service. Here more about acct.

            – Pablo Bianchi
            1 hour ago





















          0














          I realize that this is an old question, but since it wasn't answered...



          I would assume that logrotate is doing your log rotation. Check your crontab ("crontab -l") for a logrotate task that identifies the conf file. Look in that conf file for details related to /var/log/account/pacct.



          I didn't read your script closely, but it seems like your duplicating what logrotate does - no?






          share|improve this answer
























          • My crontab -l for normal user and root user both are empty :(. As I remember, the automatic log rotation seems to happen on every boot and are related to file date and not file size, so I need a solution engineered towards disk space :)

            – Aquarius Power
            Dec 4 '13 at 23:12











          • I created a config file for logrotate that worked, but it only run once and it deletes the original log file what forces me to recreate it zeroed. Basically I would need to put this in a loop: accton off;logrotate lracct.cfg;echo -n |tee /var/log/account/pacct;accton on, or add to crontab in someway I guess (never used crontab).

            – Aquarius Power
            Dec 4 '13 at 23:26











          • Sorry - just seeing your responses, but yes, you'd need to add it to a crontab. You can configure logrotate to store more than one old version of the log, and logrotate should handle "pausing" accton while it rotates the logfile. And is the "echo -n | tee" in your example basically doing a "touch" of the file? That might be slightly clearer (if you decided to go that route).

            – skydvr
            Dec 17 '13 at 22:34



















          0














          Get the acct cron to cron.hourly instead of daily. Then, put this values in /etc/default/acct:



          ACCT_ENABLE="1"

          # Amount of days that the logs are kept.
          ACCT_LOGGING="2" # you cannot set this less than 2
          # if you don't want acct to get an error





          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f295080%2fvar-log-account-pacct-is-getting-too-big-where-is-ckpacct-to-cicle-gzip-it%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            The script that cycles the logs is in /etc/cron.daily/acct. The number of log files is controlled by /etc/default/acct, which also controls whether process accounting should be enabled at boot time.



            If you want to entirely remove process accounting, sudo apt-get purge acct should do the trick too.






            share|improve this answer
























            • With systemd you can also use systemctl to just stop and/or disable acct.service. Here more about acct.

              – Pablo Bianchi
              1 hour ago


















            1














            The script that cycles the logs is in /etc/cron.daily/acct. The number of log files is controlled by /etc/default/acct, which also controls whether process accounting should be enabled at boot time.



            If you want to entirely remove process accounting, sudo apt-get purge acct should do the trick too.






            share|improve this answer
























            • With systemd you can also use systemctl to just stop and/or disable acct.service. Here more about acct.

              – Pablo Bianchi
              1 hour ago
















            1












            1








            1







            The script that cycles the logs is in /etc/cron.daily/acct. The number of log files is controlled by /etc/default/acct, which also controls whether process accounting should be enabled at boot time.



            If you want to entirely remove process accounting, sudo apt-get purge acct should do the trick too.






            share|improve this answer













            The script that cycles the logs is in /etc/cron.daily/acct. The number of log files is controlled by /etc/default/acct, which also controls whether process accounting should be enabled at boot time.



            If you want to entirely remove process accounting, sudo apt-get purge acct should do the trick too.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 30 '15 at 19:05









            Kees CookKees Cook

            13.9k75791




            13.9k75791













            • With systemd you can also use systemctl to just stop and/or disable acct.service. Here more about acct.

              – Pablo Bianchi
              1 hour ago





















            • With systemd you can also use systemctl to just stop and/or disable acct.service. Here more about acct.

              – Pablo Bianchi
              1 hour ago



















            With systemd you can also use systemctl to just stop and/or disable acct.service. Here more about acct.

            – Pablo Bianchi
            1 hour ago







            With systemd you can also use systemctl to just stop and/or disable acct.service. Here more about acct.

            – Pablo Bianchi
            1 hour ago















            0














            I realize that this is an old question, but since it wasn't answered...



            I would assume that logrotate is doing your log rotation. Check your crontab ("crontab -l") for a logrotate task that identifies the conf file. Look in that conf file for details related to /var/log/account/pacct.



            I didn't read your script closely, but it seems like your duplicating what logrotate does - no?






            share|improve this answer
























            • My crontab -l for normal user and root user both are empty :(. As I remember, the automatic log rotation seems to happen on every boot and are related to file date and not file size, so I need a solution engineered towards disk space :)

              – Aquarius Power
              Dec 4 '13 at 23:12











            • I created a config file for logrotate that worked, but it only run once and it deletes the original log file what forces me to recreate it zeroed. Basically I would need to put this in a loop: accton off;logrotate lracct.cfg;echo -n |tee /var/log/account/pacct;accton on, or add to crontab in someway I guess (never used crontab).

              – Aquarius Power
              Dec 4 '13 at 23:26











            • Sorry - just seeing your responses, but yes, you'd need to add it to a crontab. You can configure logrotate to store more than one old version of the log, and logrotate should handle "pausing" accton while it rotates the logfile. And is the "echo -n | tee" in your example basically doing a "touch" of the file? That might be slightly clearer (if you decided to go that route).

              – skydvr
              Dec 17 '13 at 22:34
















            0














            I realize that this is an old question, but since it wasn't answered...



            I would assume that logrotate is doing your log rotation. Check your crontab ("crontab -l") for a logrotate task that identifies the conf file. Look in that conf file for details related to /var/log/account/pacct.



            I didn't read your script closely, but it seems like your duplicating what logrotate does - no?






            share|improve this answer
























            • My crontab -l for normal user and root user both are empty :(. As I remember, the automatic log rotation seems to happen on every boot and are related to file date and not file size, so I need a solution engineered towards disk space :)

              – Aquarius Power
              Dec 4 '13 at 23:12











            • I created a config file for logrotate that worked, but it only run once and it deletes the original log file what forces me to recreate it zeroed. Basically I would need to put this in a loop: accton off;logrotate lracct.cfg;echo -n |tee /var/log/account/pacct;accton on, or add to crontab in someway I guess (never used crontab).

              – Aquarius Power
              Dec 4 '13 at 23:26











            • Sorry - just seeing your responses, but yes, you'd need to add it to a crontab. You can configure logrotate to store more than one old version of the log, and logrotate should handle "pausing" accton while it rotates the logfile. And is the "echo -n | tee" in your example basically doing a "touch" of the file? That might be slightly clearer (if you decided to go that route).

              – skydvr
              Dec 17 '13 at 22:34














            0












            0








            0







            I realize that this is an old question, but since it wasn't answered...



            I would assume that logrotate is doing your log rotation. Check your crontab ("crontab -l") for a logrotate task that identifies the conf file. Look in that conf file for details related to /var/log/account/pacct.



            I didn't read your script closely, but it seems like your duplicating what logrotate does - no?






            share|improve this answer













            I realize that this is an old question, but since it wasn't answered...



            I would assume that logrotate is doing your log rotation. Check your crontab ("crontab -l") for a logrotate task that identifies the conf file. Look in that conf file for details related to /var/log/account/pacct.



            I didn't read your script closely, but it seems like your duplicating what logrotate does - no?







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 4 '13 at 17:12









            skydvrskydvr

            1




            1













            • My crontab -l for normal user and root user both are empty :(. As I remember, the automatic log rotation seems to happen on every boot and are related to file date and not file size, so I need a solution engineered towards disk space :)

              – Aquarius Power
              Dec 4 '13 at 23:12











            • I created a config file for logrotate that worked, but it only run once and it deletes the original log file what forces me to recreate it zeroed. Basically I would need to put this in a loop: accton off;logrotate lracct.cfg;echo -n |tee /var/log/account/pacct;accton on, or add to crontab in someway I guess (never used crontab).

              – Aquarius Power
              Dec 4 '13 at 23:26











            • Sorry - just seeing your responses, but yes, you'd need to add it to a crontab. You can configure logrotate to store more than one old version of the log, and logrotate should handle "pausing" accton while it rotates the logfile. And is the "echo -n | tee" in your example basically doing a "touch" of the file? That might be slightly clearer (if you decided to go that route).

              – skydvr
              Dec 17 '13 at 22:34



















            • My crontab -l for normal user and root user both are empty :(. As I remember, the automatic log rotation seems to happen on every boot and are related to file date and not file size, so I need a solution engineered towards disk space :)

              – Aquarius Power
              Dec 4 '13 at 23:12











            • I created a config file for logrotate that worked, but it only run once and it deletes the original log file what forces me to recreate it zeroed. Basically I would need to put this in a loop: accton off;logrotate lracct.cfg;echo -n |tee /var/log/account/pacct;accton on, or add to crontab in someway I guess (never used crontab).

              – Aquarius Power
              Dec 4 '13 at 23:26











            • Sorry - just seeing your responses, but yes, you'd need to add it to a crontab. You can configure logrotate to store more than one old version of the log, and logrotate should handle "pausing" accton while it rotates the logfile. And is the "echo -n | tee" in your example basically doing a "touch" of the file? That might be slightly clearer (if you decided to go that route).

              – skydvr
              Dec 17 '13 at 22:34

















            My crontab -l for normal user and root user both are empty :(. As I remember, the automatic log rotation seems to happen on every boot and are related to file date and not file size, so I need a solution engineered towards disk space :)

            – Aquarius Power
            Dec 4 '13 at 23:12





            My crontab -l for normal user and root user both are empty :(. As I remember, the automatic log rotation seems to happen on every boot and are related to file date and not file size, so I need a solution engineered towards disk space :)

            – Aquarius Power
            Dec 4 '13 at 23:12













            I created a config file for logrotate that worked, but it only run once and it deletes the original log file what forces me to recreate it zeroed. Basically I would need to put this in a loop: accton off;logrotate lracct.cfg;echo -n |tee /var/log/account/pacct;accton on, or add to crontab in someway I guess (never used crontab).

            – Aquarius Power
            Dec 4 '13 at 23:26





            I created a config file for logrotate that worked, but it only run once and it deletes the original log file what forces me to recreate it zeroed. Basically I would need to put this in a loop: accton off;logrotate lracct.cfg;echo -n |tee /var/log/account/pacct;accton on, or add to crontab in someway I guess (never used crontab).

            – Aquarius Power
            Dec 4 '13 at 23:26













            Sorry - just seeing your responses, but yes, you'd need to add it to a crontab. You can configure logrotate to store more than one old version of the log, and logrotate should handle "pausing" accton while it rotates the logfile. And is the "echo -n | tee" in your example basically doing a "touch" of the file? That might be slightly clearer (if you decided to go that route).

            – skydvr
            Dec 17 '13 at 22:34





            Sorry - just seeing your responses, but yes, you'd need to add it to a crontab. You can configure logrotate to store more than one old version of the log, and logrotate should handle "pausing" accton while it rotates the logfile. And is the "echo -n | tee" in your example basically doing a "touch" of the file? That might be slightly clearer (if you decided to go that route).

            – skydvr
            Dec 17 '13 at 22:34











            0














            Get the acct cron to cron.hourly instead of daily. Then, put this values in /etc/default/acct:



            ACCT_ENABLE="1"

            # Amount of days that the logs are kept.
            ACCT_LOGGING="2" # you cannot set this less than 2
            # if you don't want acct to get an error





            share|improve this answer






























              0














              Get the acct cron to cron.hourly instead of daily. Then, put this values in /etc/default/acct:



              ACCT_ENABLE="1"

              # Amount of days that the logs are kept.
              ACCT_LOGGING="2" # you cannot set this less than 2
              # if you don't want acct to get an error





              share|improve this answer




























                0












                0








                0







                Get the acct cron to cron.hourly instead of daily. Then, put this values in /etc/default/acct:



                ACCT_ENABLE="1"

                # Amount of days that the logs are kept.
                ACCT_LOGGING="2" # you cannot set this less than 2
                # if you don't want acct to get an error





                share|improve this answer















                Get the acct cron to cron.hourly instead of daily. Then, put this values in /etc/default/acct:



                ACCT_ENABLE="1"

                # Amount of days that the logs are kept.
                ACCT_LOGGING="2" # you cannot set this less than 2
                # if you don't want acct to get an error






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 3 hours ago









                Pablo Bianchi

                2,71821532




                2,71821532










                answered Dec 3 '15 at 5:19









                dzimmerdzimmer

                1




                1






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f295080%2fvar-log-account-pacct-is-getting-too-big-where-is-ckpacct-to-cicle-gzip-it%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    GameSpot

                    日野市

                    Tu-95轟炸機