Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeantet committed Jul 30, 2017
1 parent f059f87 commit cc85eb4
Show file tree
Hide file tree
Showing 27 changed files with 121 additions and 98 deletions.
1 change: 1 addition & 0 deletions cmd/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func init() {
initPlugin("filter", "sleep", sleepprocessor.New)
initPlugin("filter", "stdout", stdout.New)
initPlugin("filter", "http", httppoller.New)
initPlugin("filter", "httpout", httpoutprocessor.New)

initPlugin("filter", "use", use.New)
initPlugin("filter", "route", route.New)
Expand Down
7 changes: 7 additions & 0 deletions docs/content/filters/httpout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
+++
title = "httpout"
description = ""
weight = 10
+++

{{% processordetails httpoutprocessor %}}
2 changes: 1 addition & 1 deletion docs/content/inputs/event.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ description = "Send a blank new event on interval"
weight = 10
+++

{{% processordetails event %}}
{{% processordetails inputeventprocessor %}}
2 changes: 1 addition & 1 deletion docs/content/inputs/http.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "http"
description = "HTTPPoller allows you to call an HTTP Endpoint, decode the output of it into an event"
description = "HTTPPoller allows you to call an HTTP Endpoint, decode the output into an event"
weight = 10
+++

Expand Down
2 changes: 1 addition & 1 deletion docs/content/outputs/httpout.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
title = "http"
title = "httpout"
description = ""
weight = 10
+++
Expand Down
120 changes: 70 additions & 50 deletions docs/content/pipelines/config-value-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,62 +49,44 @@ Example:
port => 33
```

## Interval

Express interval and schedule processor run with a **cron spec** a **predefined schedule** or a **every <duration>** format.


### CRON Expression Format
A cron expression represents a set of times, using 6 space-separated fields.
## String

{{%alert success%}}**tips** : have a look at [https://contrab.guru](https://crontab.guru/) {{%/alert%}}
A string must be a single character sequence. Note that string values are
enclosed in quotes, either double or single.

| Field name | Mandatory? | Allowed values | Allowed special characters |
| ---------- | ---------- | -------------- | -------------------------- |
| Seconds | Yes | 0-59 | * / , - |
| Minutes | Yes | 0-59 | * / , - |
| Hours | Yes | 0-23 | * / , - |
| Day of month | Yes | 1-31 | * / , - ? |
| Month | Yes | 1-12 or JAN-DEC | * / , - |
| Day of week | Yes | 0-6 or SUN-SAT | * / , - ? |
Literal quotes in the string
need to be escaped with a backslash if they are of the same kind as the string delimiter, i.e. single quotes within a single-quoted string need to be escaped as well as double quotes within a double-quoted string.

Example:
```
#interval => "0 5 4 * * *" # At 04:05
#interval => "0 15 14 1 * *" # At 14:15 on day-of-month 1
#interval => "0 0 22 * * 1-5" # At 22:00 on every day-of-week from Monday through Friday.
name => "Hello world"
name => 'It\'s a beautiful day'
```

### Predefined schedules
You may use one of several pre-defined schedules in place of a cron expression.
## Codec

| Entry | Description | Equivalent To |
| ----- | ----------- | ------------- |
| @yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 *|
| @monthly | Run once a month, midnight, first of month | 0 0 0 1 * *|
| @weekly | Run once a week, midnight on Sunday | 0 0 0 * * 0|
| @daily (or @midnight) | Run once a day, midnight | 0 0 0 * * *|
| @hourly | Run once an hour, beginning of hour | 0 0 * * * *|
Codecs are essentially stream decoder or encoder depending on where it operates, as part of an input or output.
They have their own options to handle charset, formating, etc...

Example:
```
interval => "@hourly"
```
[list of available codecs]({{%relref "codecs/_index.md"%}})

### Every X
You may also schedule a processor to execute at fixed intervals. This is supported by formatting the cron spec like this:
This example codec, used in stdout or http or file or .... will encode your event into a utf-8 json with " " as indentation
```
codec => json {
charset => "UTF-8"
indent => " "
}
@every <duration>
```

where "duration" is a string accepted by [time.ParseDuration](http://golang.org/pkg/time/#ParseDuration).

For example, "@every 1h30m10s" would indicate a schedule that activates every 1 hour, 30 minutes, 10 seconds.
## Path

Note: The interval does not take the processor runtime into account. For example, if a processor takes 3 minutes to run, and it is scheduled to run every 5 minutes, it will have only 2 minutes of idle time between each run.
A path is a string that represents a valid operating system path.

Example:
```
#interval => "@every 10s" # Every 10 seconds
my_path => "/tmp/logstash"
```

## Location
Expand All @@ -124,7 +106,7 @@ Theses functions are available to go templates

| name | description | params | examples |
| ---------- | ---------- | -------------- | -------------------------- |
| TS | format event's @timestamp with jodaTime layout | params | examples |
| TS | format event's @timestamp with [jodaTime layout](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html) | params | examples |
| DateFormat | format a time.Time with jodaTime layout | params | examples |
| Time | converts the textual representation of the datetime string into a time.Time | params | examples |
| Now | returns the current local time. | params | examples |
Expand All @@ -137,26 +119,64 @@ Theses functions are available to go templates
| Trim | trim a string | params | examples |


## Path

A path is a string that represents a valid operating system path.
## Interval

Express interval and schedule processor run with a **cron spec** a **predefined schedule** or a **every <duration>** format.


### CRON Expression Format
A cron expression represents a set of times, using 6 space-separated fields.

{{%alert success%}}**tips** : have a look at [https://contrab.guru](https://crontab.guru/) {{%/alert%}}

| Field name | Mandatory? | Allowed values | Allowed special characters |
| ---------- | ---------- | -------------- | -------------------------- |
| Seconds | Yes | 0-59 | * / , - |
| Minutes | Yes | 0-59 | * / , - |
| Hours | Yes | 0-23 | * / , - |
| Day of month | Yes | 1-31 | * / , - ? |
| Month | Yes | 1-12 or JAN-DEC | * / , - |
| Day of week | Yes | 0-6 or SUN-SAT | * / , - ? |

Example:
```
my_path => "/tmp/logstash"
#interval => "0 5 4 * * *" # At 04:05
#interval => "0 15 14 1 * *" # At 14:15 on day-of-month 1
#interval => "0 0 22 * * 1-5" # At 22:00 on every day-of-week from Monday through Friday.
```

## String
### Predefined schedules
You may use one of several pre-defined schedules in place of a cron expression.

A string must be a single character sequence. Note that string values are
enclosed in quotes, either double or single.
| Entry | Description | Equivalent To |
| ----- | ----------- | ------------- |
| @yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 *|
| @monthly | Run once a month, midnight, first of month | 0 0 0 1 * *|
| @weekly | Run once a week, midnight on Sunday | 0 0 0 * * 0|
| @daily (or @midnight) | Run once a day, midnight | 0 0 0 * * *|
| @hourly | Run once an hour, beginning of hour | 0 0 * * * *|

Literal quotes in the string
need to be escaped with a backslash if they are of the same kind as the string delimiter, i.e. single quotes within a single-quoted string need to be escaped as well as double quotes within a double-quoted string.
Example:
```
interval => "@hourly"
```

### Every X
You may also schedule a processor to execute at fixed intervals. This is supported by formatting the cron spec like this:

@every <duration>

where "duration" is a string accepted by [time.ParseDuration](http://golang.org/pkg/time/#ParseDuration).

For example, "@every 1h30m10s" would indicate a schedule that activates every 1 hour, 30 minutes, 10 seconds.

Note: The interval does not take the processor runtime into account. For example, if a processor takes 3 minutes to run, and it is scheduled to run every 5 minutes, it will have only 2 minutes of idle time between each run.

Example:
```
name => "Hello world"
name => 'It\'s a beautiful day'
#interval => "@every 10s" # Every 10 seconds
```



4 changes: 2 additions & 2 deletions docs/data/processors/file.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Doc": "",
"Doc": "Read file on\n\n* received event\n* when new file discovered\n\nthis processor remember last files used, it stores references in sincedb, set it to \"/dev/null\" to not remember used files",
"DocShort": "",
"ImportPath": "/Users/sodadi/go/src/github.com/vjeantet/bitfan/processors/input-file",
"Name": "file",
Expand Down Expand Up @@ -58,7 +58,7 @@
},
{
"Alias": "discover_interval",
"DefaultValue": null,
"DefaultValue": "15",
"Doc": "How often (in seconds) we expand the filename patterns in the path option\nto discover new files to watch. Default value is 15\nWhen value is 0, processor will read file, one time, on start.",
"ExampleLS": "",
"Name": "DiscoverInterval",
Expand Down
2 changes: 1 addition & 1 deletion docs/data/processors/httpoutprocessor.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
{
"Alias": "",
"DefaultValue": "\"plain\"",
"DefaultValue": "\"json\"",
"Doc": "The codec used for input data. Input codecs are a convenient method for decoding\nyour data before it enters the input, without needing a separate filter in your bitfan pipeline",
"ExampleLS": "",
"Name": "Codec",
Expand Down
2 changes: 1 addition & 1 deletion docs/data/processors/httppoller.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Doc": "HTTPPoller allows you to call an HTTP Endpoint, decode the output of it into an event",
"Doc": "HTTPPoller allows you to call an HTTP Endpoint, decode the output into an event",
"DocShort": "",
"ImportPath": "/Users/sodadi/go/src/github.com/vjeantet/bitfan/processors/httppoller",
"Name": "httppoller",
Expand Down
2 changes: 1 addition & 1 deletion docs/data/processors/inputeventprocessor.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"Alias": "interval",
"DefaultValue": null,
"Doc": "Use CRON or BITFAN notation",
"ExampleLS": "interval =\u003e \"every_10s\"",
"ExampleLS": "interval =\u003e \"@every 10s\"",
"Name": "Interval",
"PossibleValues": null,
"Required": true,
Expand Down
4 changes: 2 additions & 2 deletions docs/data/processors/route.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
},
{
"Alias": "condition",
"DefaultValue": null,
"Doc": "set a condition to fork and route message\nwhen false, message is routed to trunk\nBy default condition is evaluated to true",
"DefaultValue": "true",
"Doc": "set a condition to fork and route message\nwhen false, message is routed to trunk\nBy default condition is evaluated to true and always pass",
"ExampleLS": "",
"Name": "Condition",
"PossibleValues": null,
Expand Down
2 changes: 1 addition & 1 deletion processors/httpout/docdoc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions processors/httpout/httpout.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type options struct {

// The codec used for input data. Input codecs are a convenient method for decoding
// your data before it enters the input, without needing a separate filter in your bitfan pipeline
// @Default "plain"
// @Default "json"
// @Type codec
Codec codecs.Codec

Expand All @@ -43,7 +43,7 @@ type options struct {
Uri string

// Add headers to output
// @default {"Content-Type" => "text/plain"}
// @default {"Content-Type" => "application/json"}
Headers map[string]string
}

Expand All @@ -58,10 +58,10 @@ type processor struct {

func (p *processor) Configure(ctx processors.ProcessorContext, conf map[string]interface{}) error {
defaults := options{
Codec: codecs.New("plain", nil, ctx.Log(), ctx.ConfigWorkingLocation()),
Codec: codecs.New("json", nil, ctx.Log(), ctx.ConfigWorkingLocation()),
Uri: "out",
Headers: map[string]string{
"Content-Type": "text/plain",
"Content-Type": "application/json",
},
}
p.opt = &defaults
Expand Down
6 changes: 3 additions & 3 deletions processors/httpout/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ URL is available as http://webhookhost/pluginLabel/URI
| Add_field | hash | false | {} |
| Tags | array | false | [] |
| Type | string | false | "" |
| Codec | codec | false | "plain" |
| Codec | codec | false | "json" |
| Uri | string | false | "out" |
| Headers | hash | false | {} |

Expand Down Expand Up @@ -43,7 +43,7 @@ Add a type field to all events handled by this input

### Codec
* Value type is codec
* Default value is `"plain"`
* Default value is `"json"`

The codec used for input data. Input codecs are a convenient method for decoding
your data before it enters the input, without needing a separate filter in your bitfan pipeline
Expand All @@ -69,7 +69,7 @@ httpoutprocessor{
add_field => {}
tags => []
type => ""
codec => "plain"
codec => "json"
uri => "out"
headers => {}
}
Expand Down
2 changes: 1 addition & 1 deletion processors/httppoller/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# HTTPPOLLER
HTTPPoller allows you to call an HTTP Endpoint, decode the output of it into an event
HTTPPoller allows you to call an HTTP Endpoint, decode the output into an event

## Synopsys

Expand Down
2 changes: 1 addition & 1 deletion processors/httppoller/docdoc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion processors/httppoller/httppoller.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:generate bitfanDoc
//HTTPPoller allows you to call an HTTP Endpoint, decode the output of it into an event
//HTTPPoller allows you to call an HTTP Endpoint, decode the output into an event
package httppoller

import (
Expand Down
2 changes: 1 addition & 1 deletion processors/input-event/docdoc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion processors/input-event/inputevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type options struct {
Message string

// Use CRON or BITFAN notation
// @ExampleLS interval => "every_10s"
// @ExampleLS interval => "@every 10s"
Interval string `mapstructure:"interval" validate:"required"`
}

Expand Down
2 changes: 1 addition & 1 deletion processors/input-event/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ inputeventprocessor{
tags => []
type => ""
message => ""
interval => "every_10s"
interval => "@every 10s"
}
```
Loading

0 comments on commit cc85eb4

Please sign in to comment.