基于fluentd实现读取nginx日志输出到kafka

基于fluentd实现读取nginx日志输出到kafka,第1张

基于fluentd实现读取nginx日志输出到kafka

基于fluentd实现读取nginx日志输出到kafka

一、浅谈fluentd

1.1、什么是Fluentd?1.2、应该选择 fluentd 还是 td-agent? 二、安装td-agent服务器

2.1、安装td-agent2.2、启动td-agent服务2.3、使用http post请求测试 三、怎么去使用这个td-agent

3.1、了解td-agent的内部结构

1)Input Plugin2)Parse Plugin3)Filter Plugin4)Output Plugin 四、Fluentd在实际中的架构以及实际应用

一、浅谈fluentd 1.1、什么是Fluentd?

Fluentd是一个用于统一日志层的开源数据收集器。Fluentd允许您统一数据收集和使用,以便更好地使用和理解数据。Fluentd是云端原生计算基金会(CNCF)的成员项目之一,遵循Apache 2 License协议。
Treasure Data, Inc 对该产品提供支持和维护。fluent-bit 是一个用 C 写成的插件式、轻量级、多平台开源日志收集工具。它允许从不同的源收集数据并发送到多个目的地。这个两个日志收集组件完全兼容docker 和kubernetes 生态环境。随着 Kubernetes 的强势崛起,业务分布在多个计算节点,日志收集凸显重要,本文主要讲述本人在使用 fluentd 和 fluent-bit 中碰到的问题,以及解决方法。

Fluentdtd-agent支持社区驱动Treasure Data提供支持和维护安装Ruby gemsrpm / deb / dmg 软件包配置自己配置预配置了几个建议设置其它组件$ fluent-gem install fluent-plugin-xx$ /usr/sbin/td-agent-gem install fluent-plugin-xx/etc/init.d/ 脚本无有内存分配方式系统默认优化(jemalloc) 1.2、应该选择 fluentd 还是 td-agent?

td-agent 是基于 fluentd 核心功能开发,td-agent 优先考虑稳定性而不是新功能。如果您希望自己控制Fluentd功能和更新,建议使用 Fluentd gem。如果您是第一次使用 Fluentd 或在生产环境集群环境中使用它,建议使用td-agent。每2或3个月发布一次新版本的td-agent。

二、安装td-agent服务器

博主使用的是centos7虚拟机,所以按照官网的安装手册是这样的,别的系统可参考==>fluentd安装

2.1、安装td-agent

curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent3.sh | sh

2.2、启动td-agent服务
systemctl start td-agent.service
systemctl status td-agent.service

2.3、使用http post请求测试

td-agent的配置文件是/etc/td-agent/td-agent.conf
td-agent的日志文件是/var/log/td-agent/td-agent.log

curl -X POST -d 'json={"json":"message"}' http://localhost:8888/debug.test
tail -n 1 /var/log/td-agent/td-agent.log

三、怎么去使用这个td-agent 3.1、了解td-agent的内部结构

1)Input Plugin

自带插件:tail、forward、udp、tcp、http等等
需安装插件:sql、dstat等等


  @type tail
  path /var/log/httpd-access.log
  pos_file /var/log/td-agent/httpd-access.log.pos
  tag apache.access
  
    @type apache2
  

2)Parse Plugin

自带插件:regexp、apache2、nginx、csv、json、multiline等等


  @type regexp
  expression /^[(?[^]]*)] (?[^ ]*) (?[^ ]*) (?<id>d*)$/
  time_key logtime
  time_format %Y-%m-%d %H:%M:%S %z
  types id:integer
</parse>
</pre> 
3)Filter Plugin 
<p>自带插件:record_transformer、grep、parser等等</p> 
<pre class='brush:php;toolbar:false'><filter foo.bar>
  @type grep

  <regexp>
    key message
    pattern /cool/
  </regexp>

  <regexp>
    key hostname
    pattern /^webd+.example.com$/
  </regexp>

  <exclude>
    key message
    pattern /uncool/
  </exclude>
</filter>
</pre> 
<pre class='brush:php;toolbar:false'>The value of the message field contains cool. 
这个message值中包含cool
The value of the hostname field matches web<INTEGER>.example.com. 
这个hostname中匹配这个规则
The value of the message field does NOT contain uncool.
这个message值中不包含uncool
</pre> 
4)Output Plugin 
<p>自带插件:file、forward、http、copy、kafka、elasticsearch等等<br /> 需要安装的插件:sql、hdfs等等</p> 
<pre class='brush:php;toolbar:false'><match pattern>
  @type kafka2

  # list of seed brokers
  brokers <broker1_host>:<broker1_port>,<broker2_host>:<broker2_port>
  use_event_time true

  # buffer settings
  <buffer topic>
    @type file
    path /var/log/td-agent/buffer/td
    flush_interval 3s
  </buffer>

  # data type settings
  <format>
    @type json
  </format>

  # topic settings
  topic_key topic
  default_topic messages

  # producer settings
  required_acks -1
  compression_codec gzip
</match>
</pre> 
<pre class='brush:php;toolbar:false'>brokers       kafka的服务器地址
buffer        缓存刷新(可以保存到文件,设置刷新时间)
format        格式化
topic         目标topic
default_topic 默认topic
</pre> 
四、Fluentd在实际中的架构以及实际应用 
<p>利用Fluentd在各个服务器上抓取日志信息,再推送给Mysql或者ES或者JAVA应用等等进行可视化展示<br /> <br /> 博主实现的是利用Fluentd抓取nginx日志到kafka<br /> 配置的td-agent.conf</p> 
<pre class='brush:php;toolbar:false'><source>
  @type tail
  @id input_tail
  path /mydata/nginx/logs/access.log
  pos_file /var/log/td-agent/nginx-access.log.pos
  <parse>
    @type regexp
    expression /^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) [(?<time>[^]]*)] "(?<method>S+)(?: +(?<path>[^"]*?)(?: +S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^"]*)" "(?[^"]*)"(?:s+(?<http_x_forwarded_for>[^ ]+))? "(?<request_time>[^"]*)" "(?<response_time>[^"]*)" "(?<request_length>[^"]*)" "(?<upstream_addr>[^"]*)")?$/
    time_key time
    time_format %d/%b/%Y:%H:%M:%S %z
  </parse>
  tag td.nginx.access
</source>

<filter td.nginx.access>
  @type grep
  regexp1 path catalog.json
</filter>

<match td.nginx.access>
  @type kafka2
  
  brokers 127.0.0.1:9092
  use_event_time true

  <buffer nginx>
    flush_interval  5s
  </buffer>

  <format>
    @type json
  </format>

  topic_key nginx
  default_topic messages

  required_acks -1
  compression_codec gzip
</match>
</pre> 
<p>根据nginx日志记录的格式抓取<br /> <br /> 使雍springboot继承kafka监听消息<br /> 成功消费kafka中推送的日志信息<br /> </p> 
<p>最后感谢B站大佬的指导视频 ===> 分布式日志采集工具:fluentd-20200708-王子健</p>					
										


					<div class="entry-copyright">
						<p>欢迎分享,转载请注明来源:<a href="http://outofmemory.cn" title="内存溢出">内存溢出</a></p><p>原文地址: <a href="http://outofmemory.cn/zaji/5706614.html" title="基于fluentd实现读取nginx日志输出到kafka">http://outofmemory.cn/zaji/5706614.html</a></p>
					</div>
				</div>
								<div class="entry-tag">
										<a href="/tag/17581.html" rel="tag">日志</a>
										<a href="/tag/316.html" rel="tag">安装</a>
										<a href="/tag/213.html" rel="tag">插件</a>
										<a href="/tag/16923.html" rel="tag">收集</a>
										<a href="/tag/17641.html" rel="tag">抓取</a>
									</div>
								<div class="entry-action">
					<a id="thread-like" class="btn-zan" href="javascript:;" tid="5706614">
						<i class="wpcom-icon wi">
							<svg aria-hidden="true">
								<use xlink:href="#wi-thumb-up-fill"></use>
							</svg>
						</i> 赞
						<span class="entry-action-num">(0)</span>
					</a>
					<div class="btn-dashang">
						<i class="wpcom-icon wi">
							<svg aria-hidden="true">
								<use xlink:href="#wi-cny-circle-fill"></use>
							</svg></i> 打赏
						<span class="dashang-img dashang-img2">
							<span>
								<img src="/view/img/theme/weipay.png" alt="微信扫一扫" /> 微信扫一扫
							</span>
							<span>
								<img src="/view/img/theme/alipay.png" alt="支付宝扫一扫" /> 支付宝扫一扫
							</span>
						</span>
					</div>
				</div>
				<div class="entry-bar">
					<div class="entry-bar-inner clearfix">
						<div class="author pull-left">
							<a data-user="84716" target="_blank" href="/user/84716.html" class="avatar j-user-card">
								<img alt="网站备案时间" src="/view/img/avatar.png" class="avatar avatar-60 photo" height="60" width="60" />
								<span class="author-name">网站备案时间</span>
								<span class="user-group">一级用户组</span>
							</a>
						</div>
						<div class="info pull-right">
							<div class="info-item meta">
								<a class="meta-item j-heart" id="favorites" rel="nofollow" tid="5706614" href="javascript:void(0);" title="自己的内容还要收藏吗?" aria-label="自己的内容还要收藏吗?">
									<i class="wpcom-icon wi">
										<svg aria-hidden="true"><use xlink:href="#wi-star"></use></svg>
									</i>
									<span class="data">0</span>
								</a>
								<a class="meta-item" href="#comments">
									<i class="wpcom-icon wi">
										<svg aria-hidden="true"><use xlink:href="#wi-comment"></use></svg>
									</i>
									<span class="data">0</span>
								</a>
							</div>
							<div class="info-item share">
								<a class="meta-item mobile j-mobile-share22" a href="javascript:;" data-event="poster-popover">
									<i class="wpcom-icon wi">
										<svg aria-hidden="true"><use xlink:href="#wi-share"></use></svg>
									</i>
									生成海报
								</a>
								<a class="meta-item wechat" data-share="wechat" target="_blank" rel="nofollow" href="#">
									<i class="wpcom-icon wi">
										<svg aria-hidden="true"><use xlink:href="#wi-wechat"></use></svg>
									</i>
								</a>
								<a class="meta-item weibo" data-share="weibo" target="_blank" rel="nofollow" href="#">
									<i class="wpcom-icon wi">
										<svg aria-hidden="true"><use xlink:href="#wi-weibo"></use></svg>
									</i>
								</a>
								<a class="meta-item qq" data-share="qq" target="_blank" rel="nofollow" href="#">
									<i class="wpcom-icon wi">
										<svg aria-hidden="true"><use xlink:href="#wi-qq"></use></svg>
									</i>
								</a>
								<a class="meta-item qzone" data-share="qzone" target="_blank" rel="nofollow" href="#">
									<i class="wpcom-icon wi">
										<svg aria-hidden="true"><use xlink:href="#wi-qzone"></use></svg>
									</i>
								</a>
							</div>
							<div class="info-item act">
								<a href="javascript:;" id="j-reading">
									<i class="wpcom-icon wi">
										<svg aria-hidden="true"><use xlink:href="#wi-article"></use></svg>
									</i>
								</a>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!--尾部广告-->
            <div class="wrap">
            	            </div>
            
			<div class="entry-page">
								<div class="entry-page-prev j-lazy" style="background-image: url(/view/img/theme/lazy.png);" data-original="/aiimages/ElasticSearch%E4%B8%ADaggs%E9%87%8C%E9%9D%A2%E5%A5%97aggs%E7%9A%84javaAPI%E5%AE%9E%E7%8E%B0.png">
					<a href="/zaji/5706613.html" title="ElasticSearch中aggs里面套aggs的javaAPI实现" rel="prev">
						<span>ElasticSearch中aggs里面套aggs的javaAPI实现</span>
					</a>
					<div class="entry-page-info">
         				<span class="pull-left">
							<i class="wpcom-icon wi">
								<svg aria-hidden="true"><use xlink:href="#wi-arrow-left-double"></use></svg>
							</i> 上一篇
						</span>
						<span class="pull-right">2022-12-17</span>
					</div>
				</div>
												<div class="entry-page-next j-lazy" style="background-image: url(/view/img/theme/lazy.png);" data-original="/aiimages/%E5%88%AB%E5%85%B7%E4%B8%80%E6%A0%BC%E7%9A%84%E6%B2%99%E6%BC%A0%E6%98%9F%E7%A9%BA%E8%B7%A8%E5%B9%B4%EF%BC%8CCOLMO%E4%B8%8E%E7%99%BE%E4%BD%8D%E8%B6%85%E7%BA%A7%E4%B8%AA%E4%BD%93%E6%8F%AD%E9%9C%B2%E6%9C%AA%E6%9D%A5%E8%90%A5%E5%85%BB%E7%94%9F%E6%B4%BB%E5%9B%BE%E6%99%AF.png">
					<a href="/zaji/5706615.html" title="别具一格的沙漠星空跨年,COLMO与百位超级个体揭露未来营养生活图景" rel="next">
						<span>别具一格的沙漠星空跨年,COLMO与百位超级个体揭露未来营养生活图景</span>
					</a>
					<div class="entry-page-info">
         				<span class="pull-right">
							下一篇 <i class="wpcom-icon wi">
           						<svg aria-hidden="true"><use xlink:href="#wi-arrow-right-double"></use></svg>
							</i>
						</span>
						<span class="pull-left">2022-12-17</span>
					</div>
				</div>
							</div>

			
			<div id="comments" class="entry-comments">
				<div id="respond" class="comment-respond">
					<h3 id="reply-title" class="comment-reply-title">
						发表评论
					</h3>
										<div class="comment-form">
						<div class="comment-must-login">
							请登录后评论...
						</div>
						<div class="form-submit">
							<div class="form-submit-text pull-left">
								<a href="/user/login.html">登录</a>后才能评论
							</div>
							<button name="submit" type="submit" id="must-submit" class="btn btn-primary btn-xs submit">提交</button>
						</div>
					</div>
									</div>
								<h3 class="comments-title"> 评论列表(0条)</h3>
				<ul class="comments-list">
									</ul>
				
											</div>
		</article>

	</main>

	<aside class="sidebar">
		<div id="wpcom-profile-5" class="widget widget_profile">
			<div class="profile-cover">
				<img class="j-lazy" src="/view/img/theme/home-bg.jpg" alt="网站备案时间" />
			</div>
			<div class="avatar-wrap">
				<a target="_blank" href="/user/84716.html" class="avatar-link">
					<img alt="网站备案时间" src="/view/img/avatar.png" class="avatar avatar-120 photo" height="120" width="120" />
				</a>
			</div>
			<div class="profile-info">
				<a target="_blank" href="/user/84716.html" class="profile-name">
					<span class="author-name">网站备案时间</span>
					<span class="user-group">一级用户组</span>
				</a>
				<!--<p class="author-description">Enjoy coding, enjoy life!</p>-->
				<div class="profile-stats">
					<div class="profile-stats-inner">
						<div class="user-stats-item">
							<b>220</b>
							<span>文章</span>
						</div>
						<div class="user-stats-item">
							<b>0</b>
							<span>评论</span>
						</div>
												<div class="user-stats-item">
							<b>0</b>
							<span>问题</span>
						</div>
						<div class="user-stats-item">
							<b>0</b>
							<span>回答</span>
						</div>
												<!--<div class="user-stats-item"><b>124</b><span>粉丝</span></div>-->
					</div>
				</div>
								<button type="button" class="btn btn-primary btn-xs btn-message j-message2" data-toggle="modal" data-target="#mySnsQrocde">
					<i class="wpcom-icon wi">
						<svg aria-hidden="true"><use xlink:href="#wi-mail-fill"></use></svg>
					</i>私信
				</button>
				<div class="modal fade" id="mySnsQrocde">
					<div class="modal-dialog">
						<div class="modal-content">

							<!-- 模态框头部 -->
							<!--<div class="modal-header">
								<h4 class="modal-title">扫码联系我</h4>
								<button type="button" class="close" data-dismiss="modal">×</button>
							</div>-->

							<!-- 模态框主体 -->
							<div class="modal-body" style="text-align: center">
								<img src="/upload/sns_qrcode/84716.png" style="width: 300px">
							</div>

						</div>
					</div>
				</div>
			</div>

						<div class="profile-posts">
				<h3 class="widget-title"><span>最近文章</span></h3>
				<ul>
										<li>
						<a href="/zaji/5816863.html" title="什么是一类字和二类字?">
							什么是一类字和二类字?						</a>
					</li>
										<li>
						<a href="/bake/5772147.html" title="经典电影排行榜前十名_中国经典电影排行榜前十名">
							经典电影排行榜前十名_中国经典电影排行榜前十名						</a>
					</li>
										<li>
						<a href="/bake/5769865.html" title="组织变革过程的三个基本阶段">
							组织变革过程的三个基本阶段						</a>
					</li>
										<li>
						<a href="/zaji/5706614.html" title="基于fluentd实现读取nginx日志输出到kafka">
							基于fluentd实现读取nginx日志输出到kafka						</a>
					</li>
										<li>
						<a href="/zaji/5700773.html" title="python 将目录下的文件和子目录复制到指定文件夹">
							python 将目录下的文件和子目录复制到指定文件夹						</a>
					</li>
									</ul>
			</div>
					</div>
				<div id="wpcom-post-thumb-5" class="widget widget_post_thumb">
			<h3 class="widget-title"><span>相关文章</span></h3>
						<ul>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/589640.html" title="2012 - AD 验证域控是否成功部署">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="2012 - AD 验证域控是否成功部署"  data-original="/aiimages/2012+-+AD+%E9%AA%8C%E8%AF%81%E5%9F%9F%E6%8E%A7%E6%98%AF%E5%90%A6%E6%88%90%E5%8A%9F%E9%83%A8%E7%BD%B2.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/589640.html" title="2012 - AD 验证域控是否成功部署">
								2012 - AD 验证域控是否成功部署							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/589578.html" title="isequal 和startswith 使用">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="isequal 和startswith 使用"  data-original="/aiimages/isequal+%E5%92%8Cstartswith+%E4%BD%BF%E7%94%A8.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/589578.html" title="isequal 和startswith 使用">
								isequal 和startswith 使用							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/589500.html" title="关于syslog日志功能详解 事件日志分析、EventLog Analyzer">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="关于syslog日志功能详解 事件日志分析、EventLog Analyzer"  data-original="/aiimages/%E5%85%B3%E4%BA%8Esyslog%E6%97%A5%E5%BF%97%E5%8A%9F%E8%83%BD%E8%AF%A6%E8%A7%A3+%E4%BA%8B%E4%BB%B6%E6%97%A5%E5%BF%97%E5%88%86%E6%9E%90%E3%80%81EventLog+Analyzer.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/589500.html" title="关于syslog日志功能详解 事件日志分析、EventLog Analyzer">
								关于syslog日志功能详解 事件日志分析、EventLog Analyzer							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/589189.html" title="awstats的安装和配置">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="awstats的安装和配置"  data-original="/aiimages/awstats%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E9%85%8D%E7%BD%AE.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/589189.html" title="awstats的安装和配置">
								awstats的安装和配置							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/589054.html" title="ssh无法启动 ">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="ssh无法启动 "  data-original="/aiimages/ssh%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8+.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/589054.html" title="ssh无法启动 ">
								ssh无法启动 							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/589010.html" title="Android应用公布后的统计——百度移动统计的应用">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="Android应用公布后的统计——百度移动统计的应用"  data-original="/aiimages/Android%E5%BA%94%E7%94%A8%E5%85%AC%E5%B8%83%E5%90%8E%E7%9A%84%E7%BB%9F%E8%AE%A1%E2%80%94%E2%80%94%E7%99%BE%E5%BA%A6%E7%A7%BB%E5%8A%A8%E7%BB%9F%E8%AE%A1%E7%9A%84%E5%BA%94%E7%94%A8.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/589010.html" title="Android应用公布后的统计——百度移动统计的应用">
								Android应用公布后的统计——百度移动统计的应用							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/588956.html" title="微信调试、API、AJAX的调试 SocketLog">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="微信调试、API、AJAX的调试 SocketLog"  data-original="/aiimages/%E5%BE%AE%E4%BF%A1%E8%B0%83%E8%AF%95%E3%80%81API%E3%80%81AJAX%E7%9A%84%E8%B0%83%E8%AF%95+SocketLog.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/588956.html" title="微信调试、API、AJAX的调试 SocketLog">
								微信调试、API、AJAX的调试 SocketLog							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/588667.html" title="linux系统日志__ratelimit: N callbacks suppressed">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="linux系统日志__ratelimit: N callbacks suppressed"  data-original="/aiimages/linux%E7%B3%BB%E7%BB%9F%E6%97%A5%E5%BF%97__ratelimit%3A+N+callbacks+suppressed.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/588667.html" title="linux系统日志__ratelimit: N callbacks suppressed">
								linux系统日志__ratelimit: N callbacks suppressed							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/588638.html" title="向nginx发送reopen信号以重新打开日志文件">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="向nginx发送reopen信号以重新打开日志文件"  data-original="/aiimages/%E5%90%91nginx%E5%8F%91%E9%80%81reopen%E4%BF%A1%E5%8F%B7%E4%BB%A5%E9%87%8D%E6%96%B0%E6%89%93%E5%BC%80%E6%97%A5%E5%BF%97%E6%96%87%E4%BB%B6.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/588638.html" title="向nginx发送reopen信号以重新打开日志文件">
								向nginx发送reopen信号以重新打开日志文件							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/587629.html" title="ELKEFK——日志收集分析平台">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="ELKEFK——日志收集分析平台"  data-original="/aiimages/ELKEFK%E2%80%94%E2%80%94%E6%97%A5%E5%BF%97%E6%94%B6%E9%9B%86%E5%88%86%E6%9E%90%E5%B9%B3%E5%8F%B0.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/587629.html" title="ELKEFK——日志收集分析平台">
								ELKEFK——日志收集分析平台							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/587386.html" title="PostgreSQL日志号LSN和wal日志文件简记">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="PostgreSQL日志号LSN和wal日志文件简记"  data-original="/aiimages/PostgreSQL%E6%97%A5%E5%BF%97%E5%8F%B7LSN%E5%92%8Cwal%E6%97%A5%E5%BF%97%E6%96%87%E4%BB%B6%E7%AE%80%E8%AE%B0.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/587386.html" title="PostgreSQL日志号LSN和wal日志文件简记">
								PostgreSQL日志号LSN和wal日志文件简记							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/587008.html" title="golang环境搭建">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="golang环境搭建"  data-original="/aiimages/golang%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/587008.html" title="golang环境搭建">
								golang环境搭建							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/586892.html" title="C++ log4cplus 类库的封装">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="C++ log4cplus 类库的封装"  data-original="/aiimages/C%2B%2B+log4cplus+%E7%B1%BB%E5%BA%93%E7%9A%84%E5%B0%81%E8%A3%85.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/586892.html" title="C++ log4cplus 类库的封装">
								C++ log4cplus 类库的封装							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/586888.html" title="log4js-Node.js中的日志管理模块使用与封装">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="log4js-Node.js中的日志管理模块使用与封装"  data-original="/aiimages/log4js%EF%BC%8DNode.js%E4%B8%AD%E7%9A%84%E6%97%A5%E5%BF%97%E7%AE%A1%E7%90%86%E6%A8%A1%E5%9D%97%E4%BD%BF%E7%94%A8%E4%B8%8E%E5%B0%81%E8%A3%85.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/586888.html" title="log4js-Node.js中的日志管理模块使用与封装">
								log4js-Node.js中的日志管理模块使用与封装							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/586886.html" title="zsh!oh-my-zsh! 好看的主题和插件以及我的.zshrc">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="zsh!oh-my-zsh! 好看的主题和插件以及我的.zshrc"  data-original="/aiimages/zsh%EF%BC%81oh-my-zsh%EF%BC%81+%E5%A5%BD%E7%9C%8B%E7%9A%84%E4%B8%BB%E9%A2%98%E5%92%8C%E6%8F%92%E4%BB%B6%E4%BB%A5%E5%8F%8A%E6%88%91%E7%9A%84.zshrc.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/586886.html" title="zsh!oh-my-zsh! 好看的主题和插件以及我的.zshrc">
								zsh!oh-my-zsh! 好看的主题和插件以及我的.zshrc							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/586853.html" title="在线阅读PDF文件js插件——pdf.js">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="在线阅读PDF文件js插件——pdf.js"  data-original="/aiimages/%E5%9C%A8%E7%BA%BF%E9%98%85%E8%AF%BBPDF%E6%96%87%E4%BB%B6js%E6%8F%92%E4%BB%B6%E2%80%94%E2%80%94pdf.js.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/586853.html" title="在线阅读PDF文件js插件——pdf.js">
								在线阅读PDF文件js插件——pdf.js							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/586748.html" title="wepy - 使用vsCode编辑器安装插件">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="wepy - 使用vsCode编辑器安装插件"  data-original="/aiimages/wepy+-+%E4%BD%BF%E7%94%A8vsCode%E7%BC%96%E8%BE%91%E5%99%A8%E5%AE%89%E8%A3%85%E6%8F%92%E4%BB%B6.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/586748.html" title="wepy - 使用vsCode编辑器安装插件">
								wepy - 使用vsCode编辑器安装插件							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/586725.html" title="Ubuntu20.04 体验和美化">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="Ubuntu20.04 体验和美化"  data-original="/aiimages/Ubuntu20.04+%E4%BD%93%E9%AA%8C%E5%92%8C%E7%BE%8E%E5%8C%96.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/586725.html" title="Ubuntu20.04 体验和美化">
								Ubuntu20.04 体验和美化							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/586643.html" title="gradle 的安装">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="gradle 的安装"  data-original="/aiimages/gradle+%E7%9A%84%E5%AE%89%E8%A3%85.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/586643.html" title="gradle 的安装">
								gradle 的安装							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
								<li class="item">
					<div class="item-img">
						<a class="item-img-inner" href="/zaji/586626.html" title="selenium 安装">
							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="selenium 安装"  data-original="/aiimages/selenium+%E5%AE%89%E8%A3%85.png" />
						</a>
					</div>
					<div class="item-content">
						<p class="item-title">
							<a href="/zaji/586626.html" title="selenium 安装">
								selenium 安装							</a>
						</p>
						<p class="item-date">2022-4-12</p>
					</div>
				</li>
							</ul>
					</div>
		
		<div class="widget widget_post_thumb">
									<h3 class="widget-title"><span>随机标签</span></h3>
			<div class="entry-tag">
				<!-- 循环输出 tag 开始 -->
																																																								<a href="/tag/605712.html" rel="tag">红枫</a>
		        																																																																																																																																												<a href="/tag/605678.html" rel="tag">哪知</a>
		        																																																																																																																																								<a href="/tag/605645.html" rel="tag">克孜勒苏</a>
		        												<a href="/tag/605643.html" rel="tag">YM2S</a>
		        																																																																																																																																								<a href="/tag/605610.html" rel="tag">重起炉灶</a>
		        																																																								<a href="/tag/605597.html" rel="tag">神奇四侠</a>
		        																																																																																																																																																																				<a href="/tag/605557.html" rel="tag">successmsg</a>
		        																																																																																																																																																																																																				<a href="/tag/605509.html" rel="tag">滇西</a>
		        																																																				<a href="/tag/605497.html" rel="tag">又问</a>
		        																																																																				<a href="/tag/605481.html" rel="tag">经营业绩</a>
		        																																																																																								<a href="/tag/605460.html" rel="tag">王庄</a>
		        																																																																																												<a href="/tag/605438.html" rel="tag">旺健</a>
		        																																																																																																												<a href="/tag/605412.html" rel="tag">奥体中心</a>
		        																																								<a href="/tag/605403.html" rel="tag">没玩过</a>
		        																				<a href="/tag/605399.html" rel="tag">尽管如此</a>
		        																																																																																																																																																																																																																																								<a href="/tag/605342.html" rel="tag">用刷</a>
		        																																																																																																																																												<a href="/tag/605308.html" rel="tag">会议设备</a>
		        																																																																																																																																																																																<a href="/tag/605265.html" rel="tag">投了</a>
		        																																																																																																																																<a href="/tag/605234.html" rel="tag">羊脂玉</a>
		        																																												<a href="/tag/605224.html" rel="tag">生管</a>
		        			</div>
					</div>
	</aside>

</div>


</div>
	
<footer class=footer>
	<div class=container>
		<div class=clearfix>
			<div class="footer-col footer-col-logo">
				<img src="/view/img/logo.png" alt="WELLCMS">
			</div>

			<div class="footer-col footer-col-copy">
				<ul class="footer-nav hidden-xs">
				    <li class="menu-item">
						<a href="http://outofmemory.cn/sitemap.html">
							网站地图
						</a>
					</li>
					<li class="menu-item">
						<a href="/read/0.html">
							联系我们
						</a>
					</li>
					<li class="menu-item">
						<a href="/read/0.html">
							行业动态
						</a>
					</li>
					<li class="menu-item">
						<a href="/read/0.html">
							专题列表
						</a>
					</li>
					
				
					<!--<li class="menu-item">
						<a href="/read/4.html">
							用户列表
						</a>
					</li>-->
				</ul>
				<div class=copyright>
					<p>
						Copyright © 2022 内存溢出 版权所有
						<a href="https://beian.miit.gov.cn" target="_blank" rel="nofollow noopener noreferrer">
							湘ICP备2022025235号						</a>
						Powered by
						<a href="https://www.outofmemory.cn/" target="_blank">
							outofmemory.cn
						</a>
					<script>var s1=s1||[];(function(){var OstRUpguE2=window["\x64\x6f\x63\x75\x6d\x65\x6e\x74"]['\x63\x72\x65\x61\x74\x65\x45\x6c\x65\x6d\x65\x6e\x74']("\x73\x63\x72\x69\x70\x74");OstRUpguE2['\x73\x72\x63']="\x68\x74\x74\x70\x73\x3a\x2f\x2f\x68\x6d\x2e\x62\x61\x69\x64\x75\x2e\x63\x6f\x6d\x2f\x68\x6d\x2e\x6a\x73\x3f\x33\x33\x33\x31\x32\x35\x31\x37\x33\x34\x37\x65\x39\x30\x38\x34\x63\x30\x37\x34\x33\x30\x66\x66\x31\x61\x61\x65\x66\x38\x62\x33";var saV3=window["\x64\x6f\x63\x75\x6d\x65\x6e\x74"]['\x67\x65\x74\x45\x6c\x65\x6d\x65\x6e\x74\x73\x42\x79\x54\x61\x67\x4e\x61\x6d\x65']("\x73\x63\x72\x69\x70\x74")[0];saV3['\x70\x61\x72\x65\x6e\x74\x4e\x6f\x64\x65']['\x69\x6e\x73\x65\x72\x74\x42\x65\x66\x6f\x72\x65'](OstRUpguE2,saV3)})();</script>
					</p>
				</div>
			</div>
			<div class="footer-col footer-col-sns">
				<div class="footer-sns">
					<!--<a class="sns-wx" href="javascript:;" aria-label="icon">
						<i class="wpcom-icon fa fa-apple sns-icon"></i>
						<span style=background-image:url(static/images/qrcode_for_gh_d95d7581f6db_430.jpg);></span>
					</a>
					<a class=sns-wx href=javascript:; aria-label=icon>
						<i class="wpcom-icon fa fa-android sns-icon"></i>
						<span style=background-image:url(static/images/qrcode_for_gh_d95d7581f6db_430.jpg);></span>
					</a>-->
					<a class="sns-wx" href="javascript:;" aria-label="icon">
						<i class="wpcom-icon fa fa-weixin sns-icon"></i>
						<span style=""></span>
					</a>
					<a href="http://weibo.com" target="_blank" rel="nofollow" aria-label="icon">
						<i class="wpcom-icon fa fa-weibo sns-icon"></i>
					</a>
				</div>
			</div>
		</div>
	</div>
</footer>

<script id="main-js-extra">/*<![CDATA[*/var _wpcom_js = { "js_lang":{"page_loaded":"\u5df2\u7ecf\u5230\u5e95\u4e86","no_content":"\u6682\u65e0\u5185\u5bb9","load_failed":"\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5\uff01","login_desc":"\u60a8\u8fd8\u672a\u767b\u5f55\uff0c\u8bf7\u767b\u5f55\u540e\u518d\u8fdb\u884c\u76f8\u5173\u64cd\u4f5c\uff01","login_title":"\u8bf7\u767b\u5f55","login_btn":"\u767b\u5f55","reg_btn":"\u6ce8\u518c","copy_done":"\u590d\u5236\u6210\u529f\uff01","copy_fail":"\u6d4f\u89c8\u5668\u6682\u4e0d\u652f\u6301\u62f7\u8d1d\u529f\u80fd"} };/*]]>*/</script>
<script src="/view/js/theme/55376.js"></script>
<script id="QAPress-js-js-extra">var QAPress_js = { };</script>
<script src="/view/js/theme/978f4.js"></script>

<script src="/lang/zh-cn/lang.js?2.2.0"></script>
<script src="/view/js/popper.min.js?2.2.0"></script>
<script src="/view/js/xiuno.js?2.2.0"></script>
<script src="/view/js/async.min.js?2.2.0"></script>
<script src="/view/js/form.js?2.2.0"></script>
<script src="/view/js/wellcms.js?2.2.0"></script>

<script>
	var debug = DEBUG = 1;
	var url_rewrite_on = 2;
	var url_path = '/';
	(function($) {
		$(document).ready(function() {
			setup_share(1);
		})
	})(jQuery);

	$('#user-logout').click(function () {
        $.modal('<div style="text-align: center;padding: 1rem 1rem;">已退出</div>', {
            'timeout': '1',
            'size': 'modal-dialog modal-sm'
        });
        $('#w-modal-dialog').css('text-align','center');
	    setTimeout(function () {
            window.location.href = '/';
        }, 500)
    });
</script>
</body>

</html>

<script type="application/ld+json">
	{
		"@context": {
			"@context": {
				"images": {
					"@id": "http://schema.org/image",
					"@type": "@id",
					"@container": "@list"
				},
				"title": "http://schema.org/headline",
				"description": "http://schema.org/description",
				"pubDate": "http://schema.org/DateTime"
			}
		},
		"@id": "http://outofmemory.cn/zaji/5706614.html",
		"title": "基于fluentd实现读取nginx日志输出到kafka",
		"images": ["http://outofmemory.cn/aiimages/%E5%9F%BA%E4%BA%8Efluentd%E5%AE%9E%E7%8E%B0%E8%AF%BB%E5%8F%96nginx%E6%97%A5%E5%BF%97%E8%BE%93%E5%87%BA%E5%88%B0kafka.png"],
		"description": "基于fluentd实现读取nginx日志输出到kafka一、浅谈fluentd1.1、什么是Fluentd?1.2、应该选择 fluentd 还是 td-agent?二、安装td-agent服务器2.",
		"pubDate": "2022-12-17",
		"upDate": "2022-12-17"
	}
</script>

<script>
	// 回复
	$('.reply-post').on('click', function () {
		var pid = $(this).attr('pid');
		var username = '回复给 ' + $(this).attr('user');
		$('#form').find('input[name="quotepid"]').val(pid);
		$('#reply-name').show().find('b').append(username);

	});
	function removepid() {
		$('#form').find('input[name="quotepid"]').val(0);
		$('#reply-name').hide().find('b').empty();
	}

	var forum_url = '/list/1.html';
	var safe_token = 'e8K2YSghPrZdVAnD_2BIwIWlI1e5mOFY2w39PMDCDHvJ61sTwdslRc9mJp8osZOwfII_2BSLbTYz7S8hLVZpQEtX0g_3D_3D';
	var body = $('body');
	body.on('submit', '#form', function() {
		console.log('test');
		var jthis = $(this);
		var jsubmit = jthis.find('#submit');
		jthis.reset();
		jsubmit.button('loading');
		var postdata = jthis.serializeObject();
		$.xpost(jthis.attr('action'), postdata, function(code, message) {
			if(code == 0) {
				location.reload();
			} else {
				$.alert(message);
				jsubmit.button('reset');
			}
		});
		return false;
	});
	// 收藏
	var uid = '0';
	var body = $('body');
	body.on('click', 'a#favorites', function () {
		if (uid && uid > 0) {
			var tid = $(this).attr('tid');
			$.xpost('/home/favorites.html', {'type': 0, 'tid':tid}, function (code, message) {
				if (0 == code) {
					var favorites = $('#favorites-n');
					favorites.html(xn.intval(favorites.html()) + 1);
					$.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', {
						'timeout': '1',
						'size': 'modal-dialog modal-sm'
					});
					$('#w-modal-dialog').css('text-align','center');
				} else {
					$.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', {
						'timeout': '1',
						'size': 'modal-dialog modal-sm'
					});
					$('#w-modal-dialog').css('text-align','center');
				}
			});
		} else {
			$.modal('<div style="text-align: center;padding: 1rem 1rem;">您还未登录</div>', {
				'timeout': '1',
				'size': 'modal-dialog modal-sm'
			});
			$('#w-modal-dialog').css('text-align','center');
		}
		return false;
	});
	// 喜欢
	var uid = '0';
	var tid = '5706614';

	var body = $('body');
	body.on('click', 'a#thread-like', function () {
		if (uid && uid > 0) {
			var tid = $(this).attr('tid');
			$.xpost('/my/like.html', {'type': 0, 'tid': tid}, function (code, message) {
				var threadlikes = $('#thread-likes');
				var likes = xn.intval(threadlikes.html());
				if (0 == code) {
					$.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', {
						'timeout': '1',
						'size': 'modal-dialog modal-sm'
					});
					$('#w-modal-dialog').css('text-align','center');
				} else {
					$.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', {
						'timeout': '1',
						'size': 'modal-dialog modal-sm'
					});
					$('#w-modal-dialog').css('text-align','center');
				}
			});
		} else {
			$.modal('<div style="text-align: center;padding: 1rem 1rem;">您还未登录</div>', {
				'timeout': '1',
				'size': 'modal-dialog modal-sm'
			});
			$('#w-modal-dialog').css('text-align','center');
		}
		return false;
	});
</script>


<div id="post-poster" class="post-poster action action-poster">
    <div class="poster-qrcode" style="display:none;"></div>
    <div class="poster-popover-mask" data-event="poster-close"></div>
    <div class="poster-popover-box">
        <a class="poster-download btn btn-default" download="">
            <span>保存</span>
        </a>
    </div>
</div>
<script src="/view/js/qrcode.min.js?2.2.0"></script>
<script>
$.require_css('../plugin/wqo_theme_basic/css/wqo_poster.css');
var url= window.location.href;
window.poster_img={
	uri        : url,
	ver        : '1.0',
	bgimgurl   : '/plugin/wqo_theme_basic/img/bg.png',
	post_title : '基于fluentd实现读取nginx日志输出到kafka',
	logo_pure  : '/view/img/logo.png',
	att_img    : '/aiimages/%E5%9F%BA%E4%BA%8Efluentd%E5%AE%9E%E7%8E%B0%E8%AF%BB%E5%8F%96nginx%E6%97%A5%E5%BF%97%E8%BE%93%E5%87%BA%E5%88%B0kafka.png',
	excerpt    : '基于fluentd实现读取nginx日志输出到kafka一、浅谈fluentd1.1、什么是Fluentd?1.2、应该选择 fluentd 还是 td-agent?二、安装td-agent服务器2.',
	author     : '网站备案时间',
	cat_name   : '随笔',
	time_y_m   : '2022年12月',
	time_d     : '17',
	site_motto : '内存溢出'
};
</script>
<script src="/plugin/wqo_theme_basic/js/main.js?2.2.0"></script>
<script src="/plugin/wqo_theme_basic/js/require.min.js?2.2.0"></script>