Announcement

Collapse
No announcement yet.

how do I write to /var/log/messages?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    how do I write to /var/log/messages?

    Hi All,

    In a script, in Red Hat, I use a utility called "logger" to write to /var/log/messages. How do I do this in Kubuntu?

    Many thanks,
    -T

    #2
    Re: how do I write to /var/log/messages?

    Originally posted by ToddAndMargo
    Hi All,

    In a script, in Red Hat, I use a utility called "logger" to write to /var/log/messages. How do I do this in Kubuntu?

    Many thanks,
    -T
    Right under my nose. In Red Hat it is "/bin/logger"; in Ubuntu it is "/usr/bin/logger". If the package is missing, you can get it with

    Code:
    apt-get install bsdutils
    -T

    Comment


      #3
      Re: how do I write to /var/log/messages?


      you will not write to /var/log/messages that way.

      afaik the default location for kubuntu is /var/log/syslog

      see /etc/syslog.conf for details.

      Comment


        #4
        Re: how do I write to /var/log/messages?

        Originally posted by ToddAndMargo
        Hi All,

        In a script, in Red Hat, I use a utility called "logger" to write to /var/log/messages. How do I do this in Kubuntu?

        Many thanks,
        -T
        Hi

        Pardon my curiosity, but why would you want to manually add anything to /var/log/messages?
        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
        – John F. Kennedy, February 26, 1962.

        Comment


          #5
          Re: how do I write to /var/log/messages?

          Originally posted by GreyGeek
          Originally posted by ToddAndMargo
          Hi All,

          In a script, in Red Hat, I use a utility called "logger" to write to /var/log/messages. How do I do this in Kubuntu?

          Many thanks,
          -T
          Hi

          Pardon my curiosity, but why would you want to manually add anything to /var/log/messages?
          Things I want a record of that are done at boot time or by crond that I want a record of. That a look at part of my CentOS's rc.local:
          Code:
          # If Virtual Box is not loading, it is probably due to
          # a kernel change. If not loaded, re-run VB setup
          if [ -n "`/etc/rc.d/init.d/vboxdrv status | grep -i "not loaded"`" ]; then
            /etc/rc.d/init.d/vboxdrv setup
            logger -p user.notice -t rc.local "running Virtual Box setup (possible kernel change)"
          fi
          
          # echo your "elevator" to the log
          logger -p user.notice -t rc.local " your current elevator is: `cat /sys/block/sda/queue/scheduler`"
          HTH,
          -T

          Comment


            #6
            Re: how do I write to /var/log/messages?

            Originally posted by pansz

            you will not write to /var/log/messages that way.

            afaik the default location for kubuntu is /var/log/syslog

            see /etc/syslog.conf for details.
            I opened one term and did a "tail -f /var/log/messages" and another term and wrote to it with "logger". Works great. I am not sure what you are trying to tell me.

            -T

            Comment


              #7
              Re: how do I write to /var/log/messages?

              Originally posted by ToddAndMargo
              Things I want a record of that are done at boot time or by crond that I want a record of.
              Do they have to be in /var/log/messages? I agree with others that I wouldn't want user-created entries in a system logfile. What I do for cron jobs is dump them to a separate logfile, like this -
              Code:
              # date-stamp local cron log
              
              0 0 	* * * 	wizard 	date >> /var/log/cron-output.log
              
              # backup stuff
              
              #
              0 0 	* * * 	 wizard 	dpkg --get-selections > /home/wizard/Documents/installed-programs.log 
              0 2 	* * * 	 root 	mount -t smbfs -o username=wizard,password=xxxxxxxx //192.168.1.103/documents$ /home/wizard/wifes-pc >> /var/log/cron-output.log 2>&1
              15 2 	* * 0 	 wizard 	sh /home/wizard/scripts/rsync_cleanup.sh >> /var/log/cron-output.log 2>&1
              15 2 	* * 1-6 wizard 	sh /home/wizard/scripts/rsync_backup.sh >> /var/log/cron-output.log 2>&1
              0 4 	* * * 	 root 	umount /home/wizard/lisa-pc >> /var/log/cron-output.log 2>&1
              Hope this helps -

              we see things not as they are, but as we are.
              -- anais nin

              Comment


                #8
                Re: how do I write to /var/log/messages?

                Originally posted by wizard10000
                Originally posted by ToddAndMargo
                Things I want a record of that are done at boot time or by crond that I want a record of.
                Do they have to be in /var/log/messages? I agree with others that I wouldn't want user-created entries in a system logfile. What I do for cron jobs is dump them to a separate logfile, like this -
                Code:
                # date-stamp local cron log
                ......
                Code:
                That's what I've done as well, and I don't have to worry about any future possible changes to system files or logging paradigms. Your own cron script saving to your own log files under their own directory in your own home account.
                "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                – John F. Kennedy, February 26, 1962.

                Comment

                Working...
                X