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

@timestamp vs timestamp #83

Open
iano123 opened this issue Dec 6, 2016 · 11 comments
Open

@timestamp vs timestamp #83

iano123 opened this issue Dec 6, 2016 · 11 comments

Comments

@iano123
Copy link

iano123 commented Dec 6, 2016

Hi jptoto,

We are having an issue. Elasticsearch/logstash is alwayse saving the documents with a timestamp field name: "@timestamp". This project does the same but ompits the @ sign naming it "timestamp".

This makes it difficult to combine results from 2 indexes. Is there a way to change your logger so that it will also save "@timestamp"?

Many Thanks.
Jan

@jptoto
Copy link
Collaborator

jptoto commented Dec 6, 2016

@iano123 there is also a @timestamp field in the properties array which you can see an example of here http://jptoto.github.io/log4net.ElasticSearch/ in the sample doc. That should always be there for each event.

I wish I had originally named the timestamp field "@timestamp" so I will look to make that easier to find in the future. Let me know if that doesn't solve your issue.

@jptoto jptoto closed this as completed Dec 6, 2016
@iano123
Copy link
Author

iano123 commented Dec 6, 2016

Hi JP,

The problem is that this is in the properties field. This means we would need to use properties.@timestamp in the index definition in kibana.

What we want to achieve is the folowing:

index:

system.iis.date
system.eventlogs.date
system.log4net.date

and we want to put all these in kibana as:
system.*

This way we aggregate them. But this only works if the field is called "@timestamp" and not "properties.@timestamp"

@jptoto
Copy link
Collaborator

jptoto commented Dec 6, 2016

@iano123 I'll see if I can add an option to place @timestamp at the root and if that makes sense. I'm trying to finish up a new Pluralsight course at the moment which is taking all of my free time but I'll check into this ASAP.

@jptoto jptoto reopened this Dec 6, 2016
@iano123
Copy link
Author

iano123 commented Dec 6, 2016

Many Thanks JP. I think I will probably not by the only person with this use case.

@jptoto
Copy link
Collaborator

jptoto commented Dec 6, 2016

@iano123 you're the first person who's asked for it :)

@jptoto
Copy link
Collaborator

jptoto commented Jan 5, 2017

Will check to see if Kibana can find the @timestamp field in the properties section. If it can, I don't think I will add @timestamp to the root or make an option for it as it seems to be redundant. I haven't had any other requests for this.

@jptoto
Copy link
Collaborator

jptoto commented Jan 5, 2017

This works fine in Kibana so I'm gonna go ahead and close this. Thanks for inquiring about it, I just don't think there is a big need for it and by changing the root field name it'll throw off existing users.

@jptoto jptoto closed this as completed Jan 5, 2017
@iano123
Copy link
Author

iano123 commented Jan 5, 2017

Hi JP<

yes it can see it, but it is not the same field. it is a property of something else.

This is problematic when you want it in one search index: EG:

Systemname.winlog
Systemname.log4net
Systemname.topbeat

and open the indes in kibana as Systemname.*

This does not work as it will not know which field to use for the time related data.

Will addign an optional property to rename @timestamp be a breaking change? I believe not.

@jptoto
Copy link
Collaborator

jptoto commented Jan 5, 2017

I suppose simply adding the additional field won't hurt. I can eventually deprecate the old one.

@jptoto jptoto reopened this Jan 5, 2017
@johnqa
Copy link

johnqa commented May 3, 2017

Hi jptoto,

Do you have any updates on this issue? I am also facing problems because of this timestamp notation.

Thanks!

@tylerrbrown
Copy link
Contributor

tylerrbrown commented Oct 4, 2019

Hi jptoto,

Do you have any updates on this issue? I am also facing problems because of this timestamp notation.

Thanks!

I added a pull request with a new configuration option:

  <fieldNameOverride type="log4net.ElasticSearch.FieldNameOverride, log4net.ElasticSearch">
    <original value="timeStamp" />
    <replacement value="@timestamp" />
  </fieldNameOverride>

...that allows you to override any field name (I needed @timestamp too). Fixed a few bugs I ran into, and added a setting:

rollingIndexNameDateFormat value="yyyy-MM-dd"

...so I could get the exact index name I wanted.

Cheers!

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

No branches or pull requests

4 participants