public class SyslogHeaderOperator extends Object
The way it works is as follows. You provide a raw log expected to start with a syslog header. The SyslogHeaderOperator returns to you the parsed header in one tuple, the rest of your log in another. Here is an example :
String rawLog = "Sep 21 21:24:03 fakehost the-rest-of-the-data";
Tuple header;
Tuple greedyData;
syslogHeader().on(rawLog).into(header, greedyData);
// Header contains
// I.e. if you write print(header) you get
{
"alarm": {
"sev": 0,
"facility": 0
},
"rep": {
"host": {
"name": "fakehost"
},
"ts": "Sep 21 21:24:3"
}
}
// The greedyData tuple contains the-rest-of-the-data
Note that the name of the fields are not configurable. They obey the punchplatform normalisation taxonomy.
You are free of course to change them in your punchlet should you need other field names.Constructor and Description |
---|
SyslogHeaderOperator()
This constructor is not meant to be called by applications.
|
Modifier and Type | Method and Description |
---|---|
boolean |
into(Tuple header,
Tuple data)
Fire the operator.
|
SyslogHeaderOperator |
on(String log) |
SyslogHeaderOperator |
on(Tuple log) |
public SyslogHeaderOperator()
public SyslogHeaderOperator on(String log)
log
- the input log to parse.public SyslogHeaderOperator on(Tuple log)
log
- the input log to parse, given as a tuple. It is expected to contain a String leaf.Copyright © 2022. All rights reserved.