syslog 协议及格式

官方文档:http://tools.ietf.org/html/rfc5424

 

6.  Syslog Message Format

 

6.2.  HEADER

6.2.1.  PRI

PRI=<Facility(0-23)*8+Severity(0-7)>

6.2.2.  VERSION

6.2.3.  TIMESTAMP

Example 1

        1985-04-12T23:20:50.52Z

Example 2

        1985-04-12T19:20:50.52-04:00

Example 3

        2003-10-11T22:14:15.003Z

Example 4

         2003-08-24T05:14:15.000003-07:00

6.2.4.  HOSTNAME

6.2.5.  APP-NAME

6.2.6.  PROCID

6.2.7.  MSGID

 

6.3.  STRUCTURED-DATA

6.3.1.  SD-ELEMENT

6.3.2.  SD-ID

6.3.3.  SD-PARAM

6.3.4.  Change Control

6.3.5.  Examples

Example 1 - Valid

       [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"]

This example is a structured data element with a non-IANA controlled

SD-ID of type "exampleSDID@32473", which has three parameters.

 

Example 2 - Valid

       [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][examplePriority@32473 class="high"]

This is the same example as in 1, but with a second structured data

element.  Please note that the structured data element immediately

follows the first one (there is no SP between them).

 

Example 3 - Invalid

       [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] [examplePriority@32473 class="high"]

       error : 两个SD之间,多一个空格SP character 

Example 4 - Invalid

       [ exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][examplePriority@32473 class="high"]

        error : 第一个SD内部,多一个空格SP character 

 

Example 5 - Valid

       [sigSig ver="1" rsID="1234" ... signature="..."]

Example 5 is a valid example.  It shows a hypothetical IANA-assigned

SD-ID.  The ellipses denote missing content, which has been left out

of this example for brevity.

 

 

6.4.  MSG

 

6.5.  Examples

Example 1 - with no STRUCTURED-DATA

    <34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8

#header的8个部分用空格SP,分割,<34>1除外,因为不需要SP就可以分割,

#header与STRUCTURED-DATA,MSG也是用SP分割。

Facility : 4

Severity : 2

VERSION : 1

TIMESTAMP : 2003-10-11T22:14:15.003Z

HOSTNAME : mymachine.example.com

APP-NAME : su

PROCID : unknown indicated by "-" in the STRUCTURED-DATA field

MSGID : ID47

 

STRUCTURED-DATA : no this is indicated by "-" in the STRUCTURED-DATA field

形如[exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][examplePriority@32473 class="high"]

  BOM 是控制字符,以后再搞。

MSG : 'su root' failed for lonvick on /dev/pts/8

最后的是MSG,可以包含任意空格

 

Example 2 - with no STRUCTURED-DATA

     <165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 myproc 8710 - - %% It's time to make the do-nuts.

 

Example 3 - with STRUCTURED-DATA

       <165>1 2003-10-11T22:14:15.003Z mymachine.example.com

       evntslog - ID47 [exampleSDID@32473 iut="3" eventSource=

       "Application" eventID="1011"] BOMAn application

       event log entry...

 

Example 4 - STRUCTURED-DATA Only, (no MSG)

 

       <165>1 2003-10-11T22:14:15.003Z mymachine.example.com

       evntslog - ID47 [exampleSDID@32473 iut="3" eventSource=

       "Application" eventID="1011"][examplePriority@32473

       class="high"]

This example shows a message with only STRUCTURED-DATA and no MSG

part.  This is a valid message.

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值