Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Splunk to stdout #199

Unanswered
bradly asked this question in Q&A
Discussion options

Hello,

Is it possible to use the Splunk formatter but output to stdout instead? Looking at the code for the Splunk appenders looks like they are fairly tied to a Splunk server but I thought I would ask. If it isn't possible currently, would you be open to a splunk_stdout appender pull request?

Thanks!

You must be logged in to vote

Replies: 1 comment

Comment options

We add a second log file in JSON format that the Splunk Agent consumes and forwards to the SPlunk Server. This decouples Splunk from our applications in the event Splunk goes down or is overwhelmed.

if !Rails.env.test? && !Rails.env.development?
 SemanticLogger.add_appender(
 file_name: ‘log/splunk_json.log’,
 formatter: :json,
 filter: -> log { log.payload.try!(:[], :action) != ‘health_check’ },
 level: :info,
 metrics: true
 )
end

It does not specifically use the Splunk formatter in the Splunk Appender. Seems to work well for us. There is no reason we cannot spin off the Splunk format code in the Splunk Appender into a separate Formatter so that instead of formatter: :json above, it could be formatter: :spunk.

Try the :json format and lets see if we still need to spin off the Splunk Formatter code into a separate formatter class.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Converted from issue

This discussion was converted from issue #109 on January 17, 2022 20:59.

AltStyle によって変換されたページ (->オリジナル) /