cloudfoundry / loggregator-release

Cloud Native Logging
Apache License 2.0
215 stars 149 forks source link

How to discriminate the log message of each app instances between the same app. #18

Closed guangquanhao closed 10 years ago

guangquanhao commented 10 years ago

How to discriminate the log message of each app instances between the same app. I read the code very clearly,I find that we cannot know the log message is from which app.

cf-gitbot commented 10 years ago

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: http://www.pivotaltracker.com/story/show/66927948

thecadams commented 10 years ago

Hi @guangquanhao,

Thanks for raising this issue. When you run cf logs, your apps should log with [App/<instance number>] in the log entry. For example in a recent cf logs run against our cf-gitbot:

2014-03-05T03:39:56.94-0800 [App/1]   OUT D, [2014-03-05T11:39:56.940961 #31] DEBUG -- : accepted story for issue #526

You can see from the [App/1] that the log entry came from the second instance of cf-gitbot, since the log entries are zero-indexed.

Hope that helps. If you're happy to, we can close the issue and deem it solved.

Regards, CF Community Pair (@drich10 and @thecadams)

guangquanhao commented 10 years ago

Hi,@thecadams, I see the code again,I understand you meanings. type task struct { applicationId string drainUrls []string index uint64 wardenJobId uint64 wardenContainerPath string sourceName string } The index is the app instance id.And the app instance id is written into the log message.I think the syslogsink,dumpsink,websocketsink doesn't disrciminate that the log message is from which app instance,they process the message according the app id of the message,but the message has the record of the app instance id.The final user can discriminate the message is from which app instannce by the app instance id.Am I right?

thecadams commented 10 years ago

That is correct! The app instance id is how you distinguish which application logged the error message.

Is there anything else we can help you with on this issue, or is it ok to close?

CF Community Pair (@drich10 and @thecadams)

guangquanhao commented 10 years ago

Yes,thank you!