-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ebfa6c
commit 1ad50c0
Showing
10 changed files
with
204 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Changelog | ||
|
||
0.1.0 | ||
----- | ||
* First initial beta release. | ||
|
||
0.2.0 | ||
----- | ||
* Added configuration option `json_document_type_schema` which gives ability to optionally enable and enforce a JSON schema validation for JSON format messages. | ||
* Added option `enable_syslog_format_only`, which gives the ability to run process in a mode that only accepts syslog type messages. This could be used as a logging replacement for processes that log to local syslog address. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"type": "object", | ||
"properties": { | ||
"email": { | ||
"type": "string" | ||
}, | ||
"name": { | ||
"type": "object", | ||
"properties": { | ||
"first": { | ||
"type": "string" | ||
}, | ||
"last": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"type": "object", | ||
"properties": { | ||
"item": { | ||
"type": "object", | ||
"properties": { | ||
"code": { | ||
"type": "integer" | ||
}, | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"price": { | ||
"type": "integer" | ||
}, | ||
"stock_count": { | ||
"type": "integer" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o bin/udplogbeat-$1-linux-amd64 | ||
zip bin/udplogbeat-$1-linux-amd64.zip bin/udplogbeat-$1-linux-amd64 | ||
GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o bin/udplogbeat-$1-darwin-amd64 | ||
zip bin/udplogbeat-$1-darwin-amd64.zip bin/udplogbeat-$1-darwin-amd64 | ||
GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o bin/udplogbeat-$1-windows-amd64 | ||
zip bin/udplogbeat-$1-windows-amd64.zip bin/udplogbeat-$1-windows-amd64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
"type": "string" | ||
}, | ||
"match_mapping_type": "string", | ||
"path_match": "fields.*" | ||
"match": "*" | ||
} | ||
} | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
"type": "keyword" | ||
}, | ||
"match_mapping_type": "string", | ||
"path_match": "fields.*" | ||
"match": "*" | ||
} | ||
} | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
package udploglib | ||
|
||
import ( | ||
//"errors" | ||
"fmt" | ||
"strings" | ||
//"github.com/xeipuuv/gojsonschema" | ||
) | ||
|
||
// GetLogItem returns the log entry format, elasticsearch type, message and error (if any) | ||
func GetLogItem(buf []byte) (string, string, string, error) { | ||
func GetLogItem(buf []byte) ([]string, error) { | ||
|
||
parts := strings.SplitN(string(buf), ":", 3) | ||
if len(parts) != 3 { | ||
return "", "", "", fmt.Errorf("Invalid log item") | ||
return []string{"", "", ""}, fmt.Errorf("Invalid log item") | ||
} | ||
if parts[0] != "json" && parts[0] != "plain" { | ||
return "", "", "", fmt.Errorf("Log format %s is invalid", parts[0]) | ||
return []string{"", "", ""}, fmt.Errorf("Log format %s is invalid", parts[0]) | ||
} | ||
if parts[1] == "" { | ||
return "", "", "", fmt.Errorf("A log type must be specified") | ||
return []string{"", "", ""}, fmt.Errorf("A log type must be specified") | ||
} | ||
if parts[2] == "" { | ||
return "", "", "", fmt.Errorf("Log data is empty") | ||
return []string{"", "", ""}, fmt.Errorf("Log data is empty") | ||
} | ||
|
||
return strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]), strings.TrimSpace(parts[2]), nil | ||
return []string{strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]), strings.TrimSpace(parts[2])}, nil | ||
} |