You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,57 @@ This is a plugin for [Logstash](https://github.com/elastic/logstash).
10
10
11
11
It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
12
12
13
+
## Example Usage
14
+
15
+
```ruby
16
+
output {
17
+
if [@metadata][event_type] =="product.event.created" {
18
+
mongodb {
19
+
id => "orders.projection.mongodb.product-insert"
20
+
uri => "${MONGO_DNS}"
21
+
collection => "product-aggregates"
22
+
database => "carts"
23
+
isodate => true
24
+
action => "update"
25
+
upsert => true
26
+
}
27
+
}
28
+
29
+
if [@metadata][event_type] =="product.event.updated"or [@metadata][event_type] =="product.event.deleted" {
30
+
mongodb {
31
+
id => "orders.projection.mongodb.product-update"
32
+
uri => "${MONGO_DNS}"
33
+
collection => "product-aggregates"
34
+
database => "carts"
35
+
isodate => true
36
+
action => "update"
37
+
filter => {
38
+
"_id" => "[_id]"
39
+
"store_id" => "[store_id]"
40
+
}
41
+
}
42
+
}
43
+
44
+
if [@metadata][event_type] =="stock.updated"and [quantity] >0 {
45
+
mongodb {
46
+
id => "orders.projection.mongodb.stock-update"
47
+
uri => "${MONGO_DNS}"
48
+
collection => "product-aggregates"
49
+
database => "carts"
50
+
isodate => true
51
+
action => "update"
52
+
filter => {
53
+
"_id" => "[_id]"
54
+
"store_id" => "[store_id]"
55
+
}
56
+
update_expressions => {
57
+
"$inc" => {"stock" => "[stock_delta]"}
58
+
}
59
+
}
60
+
}
61
+
}
62
+
```
63
+
13
64
## Documentation
14
65
15
66
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
0 commit comments