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

Support the timestamp processor in packetbeat #17306

Open
nkakouros opened this issue Mar 27, 2020 · 11 comments
Open

Support the timestamp processor in packetbeat #17306

nkakouros opened this issue Mar 27, 2020 · 11 comments

Comments

@nkakouros
Copy link

Describe the enhancement:
The timestamp processor is missing from packetbeat (and auditbeat/metricbeat).

Describe a specific use case for the enhancement or feature:
In the logged events, I have an event.start and event.end time that both are less that the @timestamp field. I would like to make the event.start field the timestamp of the events.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/siem (Team:SIEM)

@nkakouros
Copy link
Author

This is needed as it makes things complicated for someone who wants to replace the timestamp of the event.

As it stands now, one will need to create to e.g. an elasticsearch ingest node pipeline for that purpose. But if they want to have more than one ingest node pipelines, they either have to repeat the time-change processors in each and every pipeline or use the pipeline processor to jump to the time-change pipeline. This can quickly become complex.

@botelastic
Copy link

botelastic bot commented Apr 6, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@botelastic botelastic bot added the Stalled label Apr 6, 2021
@nkakouros
Copy link
Author

.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@adriansr
Copy link
Contributor

The point of the timestamp processor is to set @timestamp from a string in other fields, potentially in different datetime formats.

If you just want to set @timestamp from a field that is already a valid date for Elasticsearch, such as event.start or event.end, you can do so already with the convert processor:

processors:
 - convert:
      fields:
         from: event.start
         to: "@timestamp"

This is a bit counterintuitive, as there's also a copy_fields processor, but that one doesn't allow to set metadata fields like @timestamp.

@adriansr
Copy link
Contributor

@jamiehynds @andrewkroh given that we have a workaround, do you still think it's worth it to have the processor in all Beats?

@adriansr adriansr self-assigned this Jul 15, 2021
@andrewkroh
Copy link
Member

andrewkroh commented Jul 15, 2021

@adriansr Is using convert to copy the value a valid workaround? I didn't test it but I thought this was problematic because the value is not a time.Time or common.Time and you would get an error.

func (e *Event) PutValue(key string, v interface{}) (interface{}, error) {
if key == "@timestamp" {
switch ts := v.(type) {
case time.Time:
e.Timestamp = ts
case common.Time:
e.Timestamp = time.Time(ts)
default:
return nil, errNoTimestamp

@adriansr
Copy link
Contributor

It worked for me when setting it from event.start in Packetbeat, but I wasn't aware of that limitation, that will cause it to break in some cases.

@botelastic
Copy link

botelastic bot commented Sep 20, 2023

Hi!
We just realized that we haven't looked into this issue in a while. We're sorry!

We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1.
Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Sep 20, 2023
@norrietaylor norrietaylor added Team:Security-Linux Platform Linux Platform Team in Security Solution and removed Team:Security-External Integrations labels Jan 31, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform)

@botelastic botelastic bot removed the Stalled label Jan 31, 2024
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

7 participants