Skip to content

Commit 5c5448e

Browse files
authored
Merge pull request #4 from billmurrin/documentation
Updated README to support v1.1.0
2 parents 1505a54 + 7aa3536 commit 5c5448e

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,55 @@ Function Breakdown
2222

2323
Function | Description
2424
-------- | -----------
25-
slookup(stream, srcField, dstField, rtnField, timeRange) : String | Conduct a lookup in a remote stream and return a field value based on a matching source field. Similar to VLOOKUP in Excel
25+
slookup(stream, srcField, dstField, rtnField, timeRange, sortOrder) : String | Conduct a lookup in a remote stream and return a field value based on a matching source field. Similar to VLOOKUP in Excel
2626

2727
Parameter | Type | Required | Description
2828
--------- | ---- | -------- | -----------
2929
stream | String | Y | The stream to look up the source field.
3030
srcField | String | Y | The source field. The value to query for in the remote stream.
3131
dstField | String | Y | The destination field that will be queried against.
3232
rtnField | String | Y | The field to return if the query is successful.
33-
timeRange | String | Y | Relative Time Range
33+
timeRange | String | Y | Relative Time Range (Seconds)
34+
sortOrder | String | Y | Timestamp sort order either "asc" or "desc".
3435

3536
Use Case and Rule Example
3637
---
3738

38-
Below is a rule that was created to lookup the value of an IP address in order enrich Windows Event Log messages coming from WinLogBeat.
39+
Below are example rules that were created to lookup the value of an IP address in order enrich Windows Event Log messages coming from WinLogBeat.
3940

4041
In this use case, the remote stream named Systems with stream_id 58aba0cb3cbe8205e76c6145 contains system information (IP, MAC, ComputerName). This could be a dump of Directory Service Computer Objects, a listing of NBTScan results, etc.
4142

4243
The slookup function constructs a search query using the value of winlogbeat_computer_name on the computer_name field (computer_name:VALUE_OF_FIELD). If the search is successful, the ip_address field is returned. The returned value can then be added to the current stream message in the pipeline.
4344

45+
The sortOrder parameter instructs the function to either return the oldest match (ascending), or the newest match (descending) if multiple records are found during the query.
46+
4447
```
45-
rule "IP Lookup"
48+
rule "IP Lookup - Ascending"
4649
when
4750
has_field("winlogbeat_computer_name")
4851
then
49-
//StreamID, Source Field, Destination Field, Return Field, Relative Time
50-
let system_info = slookup("58aba0cb3cbe8205e76c6145", "winlogbeat_computer_name", "computer_name", "ip_address", "14400");
52+
//StreamID, Source Field, Destination Field, Return Field, Relative Time, Ascending SortOrder
53+
let system_info = slookup("58aba0cb3cbe8205e76c6145", "winlogbeat_computer_name", "computer_name", "ip_address", "14400", "asc");
5154
set_field("ip_address", to_ip(system_info));
5255
end
5356
```
5457

55-
This function has only been tested in a limited setting. Its performance impact on large remote streams and very large relative data timeframes, remains unknown.
58+
```
59+
rule "IP Lookup - Descending"
60+
when
61+
has_field("winlogbeat_computer_name")
62+
then
63+
//StreamID, Source Field, Destination Field, Return Field, Relative Time, Descending SortOrder
64+
let system_info = slookup("58aba0cb3cbe8205e76c6145", "winlogbeat_computer_name", "computer_name", "ip_address", "14400", "desc");
65+
set_field("ip_address", to_ip(system_info));
66+
end
67+
```
68+
69+
Additional Info
70+
---
71+
This function has been tested in a limited setting. Its performance impact on very large remote streams and very large relative data timeframes, remains unknown.
72+
73+
If you experience an ingestion slow-down enriching a large volume of data, you can attempt increasing *processbuffer_processors* in the graylog server.conf file.
5674

5775
More information about writing a Graylog2 processor pipeline function.
5876
https://www.graylog.org/blog/71-writing-your-own-graylog-processing-pipeline-functions

0 commit comments

Comments
 (0)