Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @timestamp generation. #35

Open
guyboertje opened this issue Oct 7, 2017 · 0 comments
Open

Add @timestamp generation. #35

guyboertje opened this issue Oct 7, 2017 · 0 comments

Comments

@guyboertje
Copy link

It seems to me, if a dissection is using append fields to define the various date elements only to reassemble them so a date filter can parse the full date again, that this is a wasted opportunity to utilise the date elements to build a @timestamp (or other) field from the elements.

Example:
dissection - "%{mon} %{day} %{yr} %{hr}:%{min}:%{sec} %{machine} %{program}"
Sample message - Mar 16 2017 00:01:25 fancy pants

One could use a new directive, for example:

dates => {
  "[@timestamp]" => ["yr", "mon", "day, "hr", "min", "sec", "yz"]
  "defaults" => {
    "tz" => "+00:00"
    "yr" => "2018"
  }
}

Similar to the Ruby constructor Time.new(year, month=nil, day=nil, hour=nil, min=nil, sec=nil, utc_offset=nil). or the Joda constructor DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, DateTimeZone zone)

Proposal:
The dates directive is a Map. It has a mix of values for string keys.
If the value is an array then the key is the new date field name and the array contains the fields names in the event hold the values for Y, M, D, h, m, s, S, Z. These fields will be removed from the event on date add success. Any number of these dates can be defined.
If the value is a map and the key == "defaults, then the map contains default values - used like so: val = event.get(key) || defaults.get(key) (adjusted for Java) internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants