iLogtail专题六:iLogtail部署及配置

 公司一直使用的Filebeat进行日志采集
 由于Filebeat采集组件一些问题,现需要使用iLogtail进行代替
 现记录下iLogtail介绍和实际使用过程
 这是iLogtail系列的第六篇文章

背景:

由于平时日志采集存在堆栈信息日志情况,需要对日志进行正确分割。

前期准备:

准备日志打印程序并启动。输出日志信息如下:

2022-03-02 14:01:30.000 DEBUG 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : 输出正常值1

2022-03-02 14:01:30.000 DEBUG 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : 输出正常值2

2022-03-02 14:01:30.000 DEBUG 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : 输出正常值3

2022-03-02 14:01:30.006 ERROR 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : ERROR

java.lang.ArithmeticException: / by zero

        at com.ai.toptea.sysm.invilid.InvilidResource.invilidJob2(InvilidResource.java:35) ~[sysm-data-invilid-2.0.0.jar:2.0.0]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_152]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_152]

        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_152]

        at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) [spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]

        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]

        at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) [spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_152]

        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_152]

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_152]

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_152]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_152]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_152]

        at java.lang.Thread.run(Thread.java:748) [na:1.8.0_152]

2022-03-02 14:01:30.006 DEBUG 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : 输出正常值4

2022-03-02 14:01:30.006 DEBUG 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : 输出正常值5

采集配置:

多行日志在提交给插件部分时也需要使用 processor_split_log_regex 进行基于行首正则的切分,日期开头配置如下:

{

    "detail":{

        "SplitKey":"content",

        "SplitRegex":"\\d+-\\d+-\\d+ \\d+:\\d+:\\d+.*"

    },

    "type":"processor_split_log_regex"

}

 

采集到kafka中的数据,已将堆栈信息和error日志正常合并,可以满足日常采集需求。

{"Time":1646200910,"Contents":[{"Key":"content","Value":"2022-03-02 14:01:50.000 DEBUG 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : 输出正常值1\n"},{"Key":"@timestamp","Value":"@timestamp"},{"Key":"beat","Value":"beat"},{"Key":"fields","Value":"fields"},{"Key":"input_type","Value":"log"},{"Key":"offset","Value":"offset"},{"Key":"type","Value":"LOGTAIL_LOG"}]}

{"Time":1646200910,"Contents":[{"Key":"content","Value":"2022-03-02 14:01:50.000 DEBUG 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : 输出正常值2\n"},{"Key":"type","Value":"LOGTAIL_LOG"},{"Key":"@timestamp","Value":"@timestamp"},{"Key":"beat","Value":"beat"},{"Key":"fields","Value":"fields"},{"Key":"input_type","Value":"log"},{"Key":"offset","Value":"offset"}]}

{"Time":1646200910,"Contents":[{"Key":"content","Value":"2022-03-02 14:01:50.000 DEBUG 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : 输出正常值3\n"},{"Key":"@timestamp","Value":"@timestamp"},{"Key":"beat","Value":"beat"},{"Key":"fields","Value":"fields"},{"Key":"input_type","Value":"log"},{"Key":"offset","Value":"offset"},{"Key":"type","Value":"LOGTAIL_LOG"}]}

{"Time":1646200910,"Contents":[{"Key":"content","Value":"2022-03-02 14:01:50.001 ERROR 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : ERROR\n\njava.lang.ArithmeticException: / by zero\n\tat com.ai.toptea.sysm.invilid.InvilidResource.invilidJob2(InvilidResource.java:35) ~[sysm-data-invilid-2.0.0.jar:2.0.0]\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_152]\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_152]\n\tat java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_152]\n\tat org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) [spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]\n\tat org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]\n\tat org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) [spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_152]\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_152]\n\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_152]\n\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_152]\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_152]\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_152]\n\tat java.lang.Thread.run(Thread.java:748) [na:1.8.0_152]\n\n"},{"Key":"input_type","Value":"log"},{"Key":"offset","Value":"offset"},{"Key":"type","Value":"LOGTAIL_LOG"},{"Key":"@timestamp","Value":"@timestamp"},{"Key":"beat","Value":"beat"},{"Key":"fields","Value":"fields"}]}

{"Time":1646200910,"Contents":[{"Key":"content","Value":"2022-03-02 14:01:50.001 DEBUG 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : 输出正常值4\n"},{"Key":"type","Value":"LOGTAIL_LOG"},{"Key":"@timestamp","Value":"@timestamp"},{"Key":"beat","Value":"beat"},{"Key":"fields","Value":"fields"},{"Key":"input_type","Value":"log"},{"Key":"offset","Value":"offset"}]}

{"Time":1646200910,"Contents":[{"Key":"content","Value":"2022-03-02 14:01:50.001 DEBUG 3049 --- [pool-5-thread-1] c.a.toptea.sysm.invilid.InvilidResource  : 输出正常值5"},{"Key":"type","Value":"LOGTAIL_LOG"},{"Key":"@timestamp","Value":"@timestamp"},{"Key":"beat","Value":"beat"},{"Key":"fields","Value":"fields"},{"Key":"input_type","Value":"log"},{"Key":"offset","Value":"offset"}]}

备注:

处理数据插件介绍可参考使用Logtail插件处理数据 - 日志服务 - 阿里云

尽量不要通过修改基础配置的方式实现,测试中修改基础设置未生效,查看源码后发现可能有所限制。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据引用和引用的内容,titanagent.service是一个服务,其中配置了CPUQuota=50%的参数。这个参数会隐性开启CPUAccounting功能。然而,由于CPUAccounting会导致无法创建real-time进程,而crs的启动需要real-time进程,所以导致crs无法正常启动。为了解决这个问题,建议将titanagent.service中的CPUQuota=50%配置去掉,以免下次重启仍然报错。的内容,titanagent进程占用了131429的内存,而与之相关的其他进程如rsyslogd、tuned和ilogtail也占用了一定的内存。总计这些进程的内存占用量约为1.9G。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [titanagent服务导致oracle数据库集群cssd进程无法启动](https://blog.csdn.net/weixin_38428614/article/details/130507734)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [一次系统宕机认识系统日志](https://blog.csdn.net/f80407515/article/details/117713689)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值