Linux Command Logger use

Source: Internet
Author: User
Tags define local syslog system log

Just copy it from somewhere else. All the explanations are as follows:

**options (Optional): * *   -D,--UDP         uses datagram (UDP) instead of using the default stream connection (TCP)-I   ,--id record-by-          line per logger process ID-   F,--file file_name       records a specific file-   h,--help        displays the help text and exits-   N,--server        writes to the specified remote syslog server, using UDP instead of the built-in syslog routines   -S,--stderr       output standard error to system log. -   T,--tag tag       Specifies the tag record-   u,--socket socket       writes to the specified socket instead of to the built-in system log routines. -   V,--version        displays the version information and exits-   p,--port port_num       uses the specified UDP port. The default port number is 514-   p,--priority priority_level       Specifies the input message log level, which can be either a number or a format specified as "Facility.level".

Let's start by experimenting with each parameter's usage.

-D Not sure how to use

-I , record the process ID, write a small case, the code is as follows:

#!/bin/"This isa test-I.""this isa test--" Sleep  -

In the/var/log/messages file, the following records are available:

2018--27t10: Wu17.838653+:xx|notice|root[9433 ]|this is a test--i2018--27t10: Wu:17.839606+ :xx|notice|root[-]|this is a test--

The-f option did not find anything special.

-N is too complex to be used for the time being.

-S, the output standard error, and the information is printed to the system log.

" ABC "
ROOT[5105]: ABC

The following is logged in the message log:

2018--27t11: £47.705041+: |notice|root[5105 ]|ABC

-T, which specifies the tag record, in the message log you can see the log that belongs to which module record,-T followed by the module name, quoted or not plus. If you do not specify-T, it is logged as root.

" This is a test " xingmuxin[23054]: This is a testlinux " xingmuxin " " This is a test " xingmuxin[25200]: This is a test
Linux-xdyuna:/home/test/shell # Logger-i-S "This a test"
ROOT[16997]: This a test

-u,-p, I don't know how to use this for the time being.

-P, which specifies the input message log level, which can be a number or a format specified as "Facility.level". For example: "-P local3.info" local3 the message level of this device is info. The default level is "User.notice"

Facility: is used to define who generated the log information: The software, the subsystem during the operation of the log information generated.             Auth:             user authorization             Authpriv:         Authorization and security             Cron:             scheduled Task             daemon:           system daemon             Kern:             kernel-related information              LPR Information                 about the Print service mail               -to-email information News               from the news server syslog information             generated             by the Syslog Information generated by the               user's program, default              ftp             UUCP               information generated by UUCP             local0~7            used to define local policies

Level: is used to define what type of log information is logged. Alert needs to take action immediately.

Debug (7)            debug info(6)             Normal message notice (5)           Normal but pay attention to warning (4) error (3)            fault status Crit (2)             Critical state alert (1) Emerg (0)            System not available

such as the following sub:

" This a test " linux-xdyuna:/home/test/shell # logger-it xingmuxin-p syslog. Info " This a test " Linux " This a test "

The logs recorded in the message are:

2018-Geneva-27T11: -:37.318344+ ,:xx|err|xingmuxin[7822]|This a test2018-Geneva-27T11: -:50.052378+ ,:xx|Info|xingmuxin[10501]|This a test2018-Geneva-27T11: in:26.995571+ ,:xx|warning|xingmuxin[31063]|this a test


Linux Command Logger use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.