Skip to main content
Question

How can I get the default `@timestamp` on elastic output?

  • March 11, 2025
  • 75 replies
  • 124 views

Elasticsearch output question. How can I get the default `@timestamp`; on elastic output? It seems like `_time` should be automatically be renamed to `@timestamp`; .

75 replies

  • Employee
  • March 11, 2025

When the data lands in Elasticsearch you are still seeing the `_time` field?


_time is automatically converted to `@timestamp`; on the outgoing event sent to elastic.... but it happens to data on the wire vs. what u see in stream.


  • Author
  • Known Participant
  • March 11, 2025

I've converted my index to TSDS and the output doesn't show any problem, but nothing shows up in elasticsearch. When I check the output of the pipeline (live), I don't see @timestamp.


  • Employee
  • March 11, 2025

The live view will still show `_time` . Are you seeing the number of documents within Elasticsearch increment?


  • Author
  • Known Participant
  • March 11, 2025

No - without errors


  • Author
  • Known Participant
  • March 11, 2025

But if I try on the console, I do get a 400 error code


  • Author
  • Known Participant
  • March 11, 2025

```{ "error": { "root_cause": [ { "type": "illegal_argument_exception", "reason": "Error extracting data stream timestamp field: Failed to parse object: expecting token of type [START_OBJECT] but found [null]" } ], "type": "illegal_argument_exception", "reason": "Error extracting data stream timestamp field: Failed to parse object: expecting token of type [START_OBJECT] but found [null]", "caused_by": { "type": "parsing_exception", "reason": "Failed to parse object: expecting token of type [START_OBJECT] but found [null]", "line": 25, "col": 1 } }, "status": 400}```


  • Author
  • Known Participant
  • March 11, 2025

I believe my problem is my template, but it's weird that the worker is not reporting the failures


  • Employee
  • March 11, 2025

The worker won't get an error as Elasticsearch has accepted the data, and then failed to parse it


  • Author
  • Known Participant
  • March 11, 2025

Would be nice to see the proper output on the live view...


> Would be nice to see the proper output on the live view...We happen to have an open feature request for this, to show data as it's sent on the wire


  • Author
  • Known Participant
  • March 11, 2025

I'm not sure how it accepted the data. Putting the timestamp in got me this output:```{ "error": { "root_cause": [ { "type": "illegal_argument_exception", "reason": "the document timestamp [1970-01-20T10:31:51.000Z] is outside of ranges of currently writable indices [[2023-03-21T18:34:05.000Z,2023-03-23T19:10:00.261Z]]" } ], "type": "illegal_argument_exception", "reason": "the document timestamp [1970-01-20T10:31:51.000Z] is outside of ranges of currently writable indices [[2023-03-21T18:34:05.000Z,2023-03-23T19:10:00.261Z]]" }, "status": 400}```


  • Author
  • Known Participant
  • March 11, 2025

Which format of @timestamp is Cribl using?


  • Author
  • Known Participant
  • March 11, 2025

  • Author
  • Known Participant
  • March 11, 2025

Hmmm. I'm using `strict_date_optional_time` which seems to be proper


```"@timestamp";:"2023-03-22T19:03:10.814Z"```ISO Format


  • Employee
  • March 11, 2025

<@U0410L186KS&gt; Just confirming, this is a datastream you are sending to, rather than a standard index?


  • Author
  • Known Participant
  • March 11, 2025

Correct


  • Author
  • Known Participant
  • March 11, 2025

I didn't see the option to select datastream but it said the output supports it


  • Employee
  • March 11, 2025

I'm not doing that anywhere, but I do know that are differences in the Logstash config when sending to a datastream


  • Author
  • Known Participant
  • March 11, 2025

I posted this and that worked:```POST /interfaces-sensors-ptx/_doc{ "name": "interfaces", "@timestamp";: "2023-03-23T19:10:00.261Z", "_time": 1679511521, "carrier-transitions": 319...}```


  • Author
  • Known Participant
  • March 11, 2025

Could not find anything specific. Looks like I might need to "sniff" traffic to see what's going on.


  • Author
  • Known Participant
  • March 11, 2025

There is differences, let me check the documentation to see if there is a way to "create" instead of "index"


  • Author
  • Known Participant
  • March 11, 2025

You can force it with Logstash using `action: create` .


  • Author
  • Known Participant
  • March 11, 2025

Or you can set data_stream: true in newer version which auto extract where you want stuff to go.https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-data_stream