how use journalctl command

Forum › Forums › New users › New Users and General Questions › how use journalctl command

  • This topic has 10 replies, 7 voices, and was last updated Apr 11-3:10 pm by stevesr0.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #201435
    ninos
    Member

      how can I add the journalctl command in my system?

      if it cannot be used,
      as antiX is a non systemd distro,

      is there another similar command to
      sudo journalctl –vacuum-size=300M ???

      • This topic was modified 5 months, 2 weeks ago by ninos.
      • This topic was modified 5 months, 2 weeks ago by ninos.
      • This topic was modified 5 months, 2 weeks ago by ninos.

      using only various GNU/Linux distros, GhostBSD and Haiku
      [perpetual antiX newbie]

      #201438
      anticapitalista
      Forum Admin

        Since antiX does not have systemd, that command is useless.
        It cleans systemd logs.

        Philosophers have interpreted the world in many ways; the point is to change it.

        antiX with runit - leaner and meaner.

        #201451
        ninos
        Member

          ok,

          is there an antiX specific command
          with which you can do
          what one can do with journalctl under a systemd distro?

          using only various GNU/Linux distros, GhostBSD and Haiku
          [perpetual antiX newbie]

          #201452
          abc-nix
          Member

            There are no systemd logs in antiX, so there is no need for a command to clean up systemd logs that don’t exist.

            If you are trying to keep your logs small, you need to configure logrotate, but there aren’t that many logs in antiX.

            How big is your /var/log/ folder? How much space does it take?
            sudo du -sh /var/log

            Corruption has two hands: the Right and the Left. Don't let them squeeze you.

            #201453
            Dave
            Forum Admin

              RM -r /var/log/* ?

              Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

              #201467
              Brian Masinick
              Moderator

                RM -r /var/log/* ?

                Probably the #1 fastest way to clean up log files. Just in case someone takes you LITERALLY, the rm -r should be lower case and run while the ‘effective user’ is root; that is ise su or prepend the command with sudo.

                --
                Brian Masinick
                Alternate "Search B":
                This search page

                #201486
                sybok
                Member

                  You could go a select-and-delete in a file manager of your choice, e.g. Midnight Commander – open terminal, ‘sudo -E mc’, change dir to ‘/var/log’ select logs to clean up and delete.

                  Since there are gzip archived logs, typically named ‘<something>.log.<integer>.gz’, you could also remove only those – find all files also in sub-directories and delete them:
                  sudo find /var/log/ -type f -name '*log.[0-9]*.gz' -exec sudo rm {} -- \;
                  You can put this into (a script called by) cron to run it monthly or weekly.

                  BEWARE: Removing current(ly opened) logs may confuse some of the running programs, emptying the files instead is safer; hence I would discourage the suggestion by @Dave as too forceful (not even sure if the programs could be able to restore the sub-directory structure which could be created only at install time and implicitly expected to be present ever since).

                  The emptying is achieved by redirecting empty command to the file ‘:> <file to empty>’, e.g.
                  :> /var/log/kern.log

                  #201490
                  ninos
                  Member

                    true!

                    $ sudo du -sh /var/log
                    2.9M /var/log

                    using only various GNU/Linux distros, GhostBSD and Haiku
                    [perpetual antiX newbie]

                    #201497
                    Dave
                    Forum Admin

                      BEWARE: Removing current(ly opened) logs may confuse some of the running programs, emptying the files instead is safer; hence I would discourage the suggestion by @Dave as too forceful (not even sure if the programs could be able to restore the sub-directory structure which could be created only at install time and implicitly expected to be present ever since).

                      Indeed, even emptying the files can cause issue with the running program. That is why logrotate/rsyslog can be set to restart services and reset permissions. Yes it is best to properly setup logrotate as abc-nix suggested to avoid the oversized log issue entirely. Also consider reviewing/configuring /etc/rsyslog.conf or whatever other log management program is used.

                      That said, probably a safer and quick way to cleanup is to RM all *.gz *.xz and \.[0-9]* files leaving only those actively in use. Then if you wanted/needed those emptied use truncate command to completely empty them or cut them to a specified size.

                      find /var/log -type f -regex ".*\.*z" -delete
                      find /var/log -type f -regex ".*\.[0-9]$" -delete
                      find /var/log -type f -exec truncate -s 512000 {} \; 

                      But even still there may be issues with different naming conventions (samba for instance)

                      Rehat doc on logging:
                      https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-viewing_and_managing_log_files

                      • This reply was modified 5 months, 2 weeks ago by Dave.

                      Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

                      #201501
                      ninos
                      Member

                        thanks, Dave!

                        using only various GNU/Linux distros, GhostBSD and Haiku
                        [perpetual antiX newbie]

                        #201509
                        stevesr0
                        Member

                          Hi ninos,

                          Do you know which logs you want to keep long term and which you want to eliminate old versions of?

                          I often turn to /var/log/apt/history.log if I have a problem or question about Sid upgrades.

                        Viewing 11 posts - 1 through 11 (of 11 total)
                        • You must be logged in to reply to this topic.