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

ingest custom log sources with custom index names #827

Closed
AtulSinghMothi opened this issue Dec 4, 2022 · 6 comments
Closed

ingest custom log sources with custom index names #827

AtulSinghMothi opened this issue Dec 4, 2022 · 6 comments
Labels

Comments

@AtulSinghMothi
Copy link

Hello Team,
Our application is deployed on multiple VMs and application is generating multiple log files. UFs are installed on all VMs and log1 is indexed with index=log1,log2 is indexed with index=log2 etc.

Now, VMs are going to be replaced by kubernetes and it is expected that log generation is going to remain same. Could you please advise how can I assign index=log1 for log1,index=log2 for log2 etc.

Thank you!

@hvaghani221
Copy link
Contributor

You can add splunk.com/index pod annotation. SCK will automatically send logs to index defined in splunk.com/index.

You can refer doc for detailed information.

@Kiyoshi-Miyake
Copy link

Hi harshit-splunk,
Your sugestion is helpful me too. thanks!
but, i tried to set these annotation, but, these are overwridden by the following parts.

      # extract pod_uid and container_name for CRIO runtime
      {{- if eq .Values.containers.logFormatType "cri" }}
      <filter tail.containers.var.log.pods.**>
        @type jq_transformer
        jq '.record | . + (.source | capture("/var/log/pods/(?<pod_uid>[^/]+)/(?<container_name>[^/]+)/(?<container_retry>[0-9]+).log")) | .sourcetype = ("{{ .Values.sourcetypePrefix }}:container:" + .container_name) | .splunk_index = {{ or .Values.global.splunk.hec.indexName .Values.splunk.hec.indexName | default "main" | quote }}'
      </filter>
      {{- end }}

templates/configMap.yaml line 308...

Do I need to remove the matching of regex for these sourcetype, index from the line?

Thanks!

@hvaghani221
Copy link
Contributor

Hey @Kiyoshi-Miyake, that is actually a bug. It's a good catch. I would love if you raise a PR to fix this :)

Kiyoshi-Miyake added a commit to Kiyoshi-Miyake/splunk-connect-for-kubernetes that referenced this issue Dec 17, 2022
fixed bug that override the "splunk.com/sourcetype" and "splunk.com/index" annotation of Pod.

ref: splunk#827
@Kiyoshi-Miyake
Copy link

Kiyoshi-Miyake commented Dec 17, 2022

Hi @harshit-splunk, I created the PR.
Can you check it.

@github-actions
Copy link

github-actions bot commented Feb 4, 2023

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Feb 4, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

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

No branches or pull requests

3 participants