ã¯ããã«
å æ¥ãDevOps åã Fluentd åå¼·ä¼ at IPROS ã§èãã話ã®ä¸ã§ Ouptput ãã©ã°ã¤ã³ã®ãããã¡ã®é¢ãã¦ä¸è¨ã®ç¹ã«ã¤ãã¦æ°ã«ãªã£ãã®ã§èª¿ã¹ããã¦ã¦ãºã¦ãºã
- Output ãã©ã°ã¤ã³ã®ã¡ã¢ãªãããã¡ã¨ãã¡ã¤ã«ãããã¡ã®æ§è½ã¯ã»ã¨ãã©å·®ç°ã¯ç¡ã
- ããã©ã«ãã¯ã¡ã¢ãªãããã¡ã ããã¡ã¤ã«ãããã¡ããªã¹ã¹ã¡
ã¾ããfluent-logger ã使ã£ã¦ãµã¼ãã¼ã®è² è·ãæ¿ããä¸ãã£ã¦ãã¾ã£ã件ã«ã¤ãã¦è³ªåããã¦é ãããããããèããã¨ãã®ãããã¡ã«ã¤ãã¦å ¨ãèæ ®ããªãã¾ã¾ã®å©ç¨ã ã£ãã®ã§ããã®ä»¶ã§ã解決ã¸ã®ç³¸å£ã«ãªãã®ã§ã¯ã¨ãããã¨ã§ã¡ã¢ãªãããã¡ã¨ãã¡ã¤ã«ãããã¡ã§ä½ãéãã®ãã調ã¹ã¦ã¿ãã
æ§æ
æ¤è¨¼ç°å¢
以ä¸ã®ãããªæ¤è¨¼ç°å¢ãç¨æããã
å½¹å² | ãããã¡ã¿ã¤ã / Output / ã¢ããªã±ã¼ã·ã§ã³ | OS | td-agent ãã¼ã¸ã§ã³ | ã¹ãã㯠| åè |
---|---|---|---|---|---|
Forwarder | ã¡ã¢ãª | Debian 6.0.7 | 1.1.17-1 | 1vcpu/512MB Memory | forward ãã©ã°ã¤ã³ã§ Collector ã¸è»¢é |
Forwarder | ãã¡ã¤ã« | Debian 6.0.7 | 1.1.17-1 | 1vcpu/512MB Memory | forward ãã©ã°ã¤ã³ã§ Collector ã¸è»¢é |
Collector | mongodb | Debian 6.0.7 | 1.1.17-1 | 2vcpu/2048MB Memory | mongodb ãå©ç¨ |
Monitoring | Cacti | Ubuntu 13.04 |
åç°å¢ã® td-agent ã«ã¤ãã¦ã¡ã¢
æ¤è¨¼ç°å¢ã®æ§ç¯ã«ã¤ãã¦ã¯é·ããªãã®ã§ cookbook
åã㦠github ã«ã¢ããï¼
ã¨ãããã Forwarder 㨠Collector ã ãã¯ã¢ãããããï¼ Debian 6 㨠7 ã ã£ããåãããï¼
以ä¸ãtd-agent
ã®è¨å®ï¼td-agent.conf
ï¼å
容ã«ã¤ãã¦æç²ã
forwarderï¼ã¡ã¢ãªãããã¡ï¼
<source> type tail format apache path /var/log/nginx/localhost.access.log tag nginx.accesslog pos_file /tmp/fluentd.pos </source> <match nginx.**> type forward buffer_type memory <server> host xxx.xxx.xxx.xxx port 24224 </server> flush_interval 60s </match>
forwarderï¼ãã¡ã¤ã«ãããã¡ï¼
<source> type tail format apache path /var/log/nginx/localhost.access.log tag nginx.accesslog pos_file /tmp/fluentd.pos </source> <match nginx.**> type forward buffer_type file buffer_path /tmp/fluentd/buffer <server> host xxx.xxx.xxx.xxx port 24224 </server> flush_interval 60s </match>
collector
# Input <source> type forward port 24224 </source> # Output <match nginx.**> type mongo database nginx collection accesslog # buffer_chunk_limit 128m # "To avoid problems, set a smaller number to the buffer_chunk_limit" ã¨ããã¡ãã»ã¼ã¸ãåºåãããã®ã§è¨å®ãã </match>
æ°ã¥ããç¹
Cacti
ã®ã°ã©ãã td-agent
ã®çºãã¦ä»¥ä¸ã®ãããªç¹ã«æ°ä»ããã
- ãããã¡ãªã³ã°æã®ã¡ã¢ãªã®ä½¿ããæ¹ã«éãããã£ã
- ãããã¡ãªã³ã°æã® CPU ã Load Average ã¸ã®è² è·ã¯å¤ããã
buffer_chunk_limit
ã«ã¤ãã¦- ï¼è¿½è¨ï¼é常éç¨æã®ãµã¼ãã¼ãªã½ã¼ã¹ã®ä½¿ããæ¹ã¯ã¡ã¢ãªãããã¡ããã¡ã¤ã«ãããã¡ãå·®ç°ã¯ç¡ãï¼
以ä¸ã¯ããããã«ã¤ãã¦å°ãçªã£è¾¼ãã§æ¸ãã¦ã¿ãã
ãããã¡ãªã³ã°æã®ã¡ã¢ãªã®ä½¿ããæ¹ã«éãã...
Collector ã® fluentd
ãæ¢ã㦠Forwarder å´ã«ãããã¡ãªã³ã°ãããããªç¶æ³ãä½ã£ã¦ã¿ã¦ Cacti
ã®ã°ã©ããè¦æ¯ã¹ã¦ã¿ãã¨ä»¥ä¸ã®ãããªéããåºããï¼æ³¨ï¼Collector å´ã® MongoDB
ãæ¢ãããã¨æ¸ãã¦ãããããã®æ§æã 㨠MongoDB
ãæ¢ãã㨠Collector ã® fluentd
ã«ãããã¡ãªã³ã°ãçºçããã®ã§ä¿®æ£ããï¼
ã¡ã¢ãªãããã¡
ãã¡ã¤ã«ãããã¡
å½ããåã¨è¨ã£ããå½ããåãªã®ãããããªããã©ãã¡ã¢ãªãããã¡ã®ãã¹ã㯠Cache
éã®æ¸å°ãè¦ãããããããããããã¡ã¨ãã¦ã¡ã¢ãªãå©ç¨ããã¦ãããã¨ã«ããæ¸å°ã¨äºæ³ãããã
ã¨ãããã¨ã¯ãã¡ã¢ãªãä½ããã®çç±ã§æ¯æ¸ãã¦ãã¾ãã¨ã¹ã¯ããã¢ã¦ããçºçãã¦ãã¾ããã¹ãã®æ§è½å£åã«ç¹ããå¯è½æ§ãããããããããã¨ããã®äºãã¡ã¢ãªãããã¡ãããã¡ã¤ã«ãããã¡ããªã¹ã¹ã¡ãã¦ããæ以ãããããªãã
ãããã¡ãªã³ã°æã® CPU ã Load Average ã¸ã®è² è·ã¯å¤ããã
ã¡ã¢ãªãããã¡
以ä¸ã¯ CPU
使ç¨çã
以ä¸ã¯ Load Average
ã
ãã¡ã¤ã«ãããã¡
以ä¸ã¯ CPU
使ç¨çã
以ä¸ã¯ Load Average
ã
CPU
ã Load Average
ã«é¢ãã¦ã¯æ®ã©å·®ç°ã¯ç¡ãããã«è¦ãããã¨ãããã¨ã§ãã¡ã¢ãªã®æ¯æ¸ãæ°ã«ããªããã¡ã¢ãªãããã¡ãå©ç¨ããçç±ã¯ãã¾ãç¡ãã®ãããããªã...
buffer_chunk_limit ã«ã¤ãã¦
ãã¾ãã¾ Collector å´ã® td-agent ãã°ãçºãã¦ããã¨ããä¸è¨ã®ãããªãã°ãåããã¦ããã
2013-11-03 09:12:53 +0900 [warn]: Size of the emitted data exceeds buffer_chunk_limit. 2013-11-03 09:12:53 +0900 [warn]: This may occur problems in the output plugins ``at this server.`` 2013-11-03 09:12:53 +0900 [warn]: To avoid problems, set a smaller number to the buffer_chunk_limit 2013-11-03 09:12:53 +0900 [warn]: in the forward output ``at the log forwarding server.``
大éã®ãã°ã Collector ã«éã¾ã£ãéã« buffer_chunk_limit
ã®ãã£ãã·ãã£ãè¶
ãã¦ãã¾ããã¨ã§åºåããããã°ã£ã½ããbuffer_chunk_limit
ã®ããã©ã«ãå¤ã¯ 8MB ã¨ã®ãã¨ããã®ä» Output ãã©ã°ã¤ã³ã®ãããã¡ã«ã¤ãã¦ã¯ä»¥ä¸ã®è¨äºãåèã«ãªã£ãã
- #fluentd fluentdã§éç´ããéã«warnãå¤çºãã件
- Fluentdã§ãããã¡ã¤ãOutputPluginã使ãã¨ãã®ããã©ã«ãå¤
- Fluentd out_forward ã«ãããæé©åãã©ã¡ã¼ã¿ããã¤ãã®è©±(http://d.hatena.ne.jp/tagomoris/20120731/1343707793)
ï¼è¿½è¨ï¼é常éç¨æã®ãµã¼ãã¼ãªã½ã¼ã¹ã®ä½¿ããæ¹ã¯ã¡ã¢ãªãããã¡ããã¡ã¤ã«ãããã¡ãå·®ç°ã¯ç¡ã
CPU
㨠Load Average
以å¤ã«ãé常éç¨æã«é¢ãã¦ã¯ã¡ã¢ãªã®ä½¿ããæ¹ãã»ã¼åãã
ã¡ã¢ãªãããã¡
ãã¡ã¤ã«ãããã¡
æå¾ã«
- å®éã«æãåããã¦ã¿ã¦è¯ãã£ã
- ãã£ããæ§ç¯ããç°å¢ãªã®ã§ãå¼ãç¶ãç£è¦ãã¦ãããã