Changes between Version 15 and Version 16 of linux/Fluentd


Ignore:
Timestamp:
2015/12/10 17:59:27 (9 years ago)
Author:
yuna
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • linux/Fluentd

    v15 v16  
    7171<source> 
    7272  type tail 
    73   path /var/log/nova/nova-api.log 
    74   pos_file /var/log/td-agent/nova-api.log.pos 
    75   tag nova-api.log 
     73  path /var/log/nova/nova-api.log,/var/log/nova/nova-manage.log 
     74  pos_file /var/log/td-agent/os.log.pos 
     75  tag os.control 
    7676  format multiline 
    7777  format_firstline /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3} / 
    78   format1 /^(?<date>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}) (?<pid>[^ ]*) (?<level>[^ ]*) (?<class>[^ ]*) \[(?<req-id>[^]]*)] (?<message>.*)/ 
     78  format1 /^(?<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}).\d{3} (?<pid>[^ ]*) (?<level>[^ ]*) (?<class>[^ ]*) (\[(?<req-id>[^]]*)] |)(?<message>.*)/ 
     79  time_format %Y-%m-%d %H:%M:%S 
    7980</source> 
    8081}}} 
     
    158159system.indexes 
    159160> db.log.find(); 
    160 { "_id" : ObjectId("563de070e138230994000001"), "date" : "2016-05-21 13:01:55.215 6322", "level" : "INFO", "class" : "nova-api.osapi_compute.wsgi.server", "tag" : "-", "message" : "(6322) accepted ('192.168.66.128', 42247)", "time" : ISODate("2015-11-07T07:34:56Z") } 
     161{ "_id" : ObjectId("56693d4308f6ff315e008110"), "pid" : "3927", "level" : "INFO", "class" : "nova.api.ec2", "req-id" : "-", "message" : "0.983s 172.20.132.214 GET /latest/meta-data/public-keys/ None:None 200 [Python-httplib2/0.7.7 (gzip)] text/plain text/plain", "host" : "control", "tag" : "os.control", "time" : ISODate("2015-12-10T03:33:45Z") } 
     162{ "_id" : ObjectId("56693d4308f6ff315e00810e"), "pid" : "3927", "level" : "INFO", "class" : "nova.api.ec2", "req-id" : "-", "message" : "0.3768s 172.20.132.214 GET /latest/meta-data/placement/availability-zone None:None 200 [Python-httplib2/0.7.7 (gzip)] text/plain text/plain", "host" : "control", "tag" : "os.control", "time" : ISODate("2015-12-10T03:33:44Z") } 
     163 
    161164.... 
    162165}}} 
     
    179182 
    180183{{{ 
    181 > db.log.find({date: {$gt: "2015-05-21 13:00",$lt: "2016-05-21 13:00"}}) ; 
     184> db.log.find({time: {$gt: ISODate("2015-12-10T03:20:00Z"),$lt: ISODate("2015-12-10T03:30:00Z")}}) 
    182185}}} 
    183186 
     
    185188 
    186189{{{ 
    187 > db.log.find({date: {$gt: "2015-05-21 13:00",$lt: "2016-05-21 13:00"},level: "INFO"}) ; 
     190> db.log.find({time: {$gt: ISODate("2015-12-10T03:20:00Z"),$lt: ISODate("2015-12-10T03:30:00Z")}, level: "INFO"}) 
    188191}}} 
    189192 
     
    199202> db.log.find().sort({$natural:-1}).limit(100) 
    200203}}} 
     204 
     205== ログ検索が遅いときは 
     206 
     207インデックスを張る。例えば、時間(time)に対してインデックスを張るには、 
     208 
     209{{{ 
     210> db.log.createIndex({time:1}) 
     211}}} 
     212 
     213とする。