其实方案三和方案二日志采集套路一样,但是还是有点差别。
差别就在于日志格式如下:
为了方便对比吧日志贴上来
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 10:51:58 localhost 939fe968a91d[4721]: 2018-11-16 02:51:58.892 INFO [demo1,fa9d2f274c9d3c59,fa9d2f274c9d3c59,false] 1 --- [hystrix-test1-1] demo1.demo1.TestRest : 我收到了其他服务调用
------------------上面是使用syslog本地打日志-----下面是使用journald打日志----------------------------------------------------------------
Nov 16 11:20:30 localhost b268cf551812: 2018-11-16 03:20:30.515 INFO [demo1,31c664ed12d6265e,31c664ed12d6265e,false] 1 --- [ystrix-test1-10] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 11:20:30 localhost b268cf551812: 2018-11-16 03:20:30.515 INFO [demo1,31c664ed12d6265e,31c664ed12d6265e,false] 1 --- [ystrix-test1-10] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 11:20:30 localhost b268cf551812: 2018-11-16 03:20:30.515 INFO [demo1,31c664ed12d6265e,31c664ed12d6265e,false] 1 --- [ystrix-test1-10] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 11:20:30 localhost b268cf551812: 2018-11-16 03:20:30.515 INFO [demo1,31c664ed12d6265e,31c664ed12d6265e,false] 1 --- [ystrix-test1-10] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 11:20:30 localhost b268cf551812: 2018-11-16 03:20:30.515 INFO [demo1,31c664ed12d6265e,31c664ed12d6265e,false] 1 --- [ystrix-test1-10] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 11:20:30 localhost b268cf551812: 2018-11-16 03:20:30.515 INFO [demo1,31c664ed12d6265e,31c664ed12d6265e,false] 1 --- [ystrix-test1-10] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 11:20:30 localhost b268cf551812: 2018-11-16 03:20:30.515 INFO [demo1,31c664ed12d6265e,31c664ed12d6265e,false] 1 --- [ystrix-test1-10] demo1.demo1.TestRest : 我收到了其他服务调用
Nov 16 11:20:30 localhost b268cf551812: 2018-11-16 03:20:30.515 INFO [demo1,31c664ed12d6265e,31c664ed12d6265e,false] 1 --- [ystrix-test1-10] demo1.demo1.TestRest : 我收到了其他服务调用
使用 journald方式与syslog不同的地方在于可以使用命令对日志进行筛选
如我们更新容器日志方式如下:
我们打印出来的日志如下
我们可以用如下命令进行筛选打印
问题和方案二是一样的不多说,可以去找方案二查看。