-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtd-agent.conf.erb
60 lines (57 loc) · 1.68 KB
/
td-agent.conf.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<source>
type tail
path /opt/minecraft/logs/latest.log
format /^\[(?<time>.*)\]\s\[(?<caused_at>[^/]*)/(?<level>.*)\]:\s(?<log>.*)$/
time_format %H:%M:%S
tag minecraft.log
pos_file /etc/td-agent/minecraft.pos
</source>
<match minecraft.log.talk>
type record_reformer
tag reformed.${tag}
player ${log.match(/^<(?<player>.*)>\s.*$/)[:player]}
message ${log.match(/^<(?<player>.*)>\s(?<message>.*)$/)[:message]}
</match>
<match minecraft.log.join>
type record_reformer
tag reformed.${tag}
player ${log.match(/^(?<player>.*)\sjoined\sthe\sgame$/)[:player]}
</match>
<match minecraft.log.left>
type record_reformer
tag reformed.${tag}
player ${log.match(/^(?<player>.*)\sleft\sthe\sgame$/)[:player]}
</match>
<match minecraft.log>
type rewrite_tag_filter
rewriterule1 log ^\<.*\>\s.*$ minecraft.log.talk
rewriterule2 log ^.*\sjoined\sthe\sgame$ minecraft.log.join
rewriterule3 log ^.*\sleft\sthe\sgame$ minecraft.log.left
</match>
<match debug.**>
type stdout
</match>
<match reformed.minecraft.log.join>
type copy
<store>
type idobata
webhook_url <%= @idobata_hook_url %>
message_template @all <%%= record['player'] %>がマイクラはじめたみたい
</store>
</match>
<match reformed.minecraft.log.left>
type copy
<store>
type idobata
webhook_url <%= @idobata_hook_url %>
message_template @all <%%= record['player'] %>がマイクラおわったみたい
</store>
</match>
<match reformed.minecraft.log.talk>
type copy
<store>
type idobata
webhook_url <%= @idobata_hook_url %>
message_template <<%%= record['player'] %>> <%%= record['message'].to_hiragana %>
</store>
</match>