Changes between Version 15 and Version 16 of linux/Fluentd
- Timestamp:
- 2015/12/10 17:59:27 (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
linux/Fluentd
v15 v16 71 71 <source> 72 72 type tail 73 path /var/log/nova/nova-api.log 74 pos_file /var/log/td-agent/ nova-api.log.pos75 tag nova-api.log73 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 76 76 format multiline 77 77 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 79 80 </source> 80 81 }}} … … 158 159 system.indexes 159 160 > 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 161 164 .... 162 165 }}} … … 179 182 180 183 {{{ 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")}}) 182 185 }}} 183 186 … … 185 188 186 189 {{{ 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"}) 188 191 }}} 189 192 … … 199 202 > db.log.find().sort({$natural:-1}).limit(100) 200 203 }}} 204 205 == ログ検索が遅いときは 206 207 インデックスを張る。例えば、時間(time)に対してインデックスを張るには、 208 209 {{{ 210 > db.log.createIndex({time:1}) 211 }}} 212 213 とする。