Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
532d476c
Commit
532d476c
authored
Nov 27, 2017
by
nadeemshahzad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rolled splunk cold to frozen data on s3 bucket
parent
4821cd12
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
3 deletions
+60
-3
playbooks/roles/splunk-server/defaults/main.yml
+3
-0
playbooks/roles/splunk-server/tasks/main.yml
+11
-1
playbooks/roles/splunk-server/templates/opt/splunk/bin/coldToFrozenS3.j2
+44
-0
playbooks/roles/splunk-server/templates/opt/splunk/etc/apps/search/local/indexes.conf.j2
+2
-2
No files found.
playbooks/roles/splunk-server/defaults/main.yml
View file @
532d476c
...
@@ -112,3 +112,6 @@ splunk_cert_path: 'etc/auth/edxcerts'
...
@@ -112,3 +112,6 @@ splunk_cert_path: 'etc/auth/edxcerts'
splunk-server_debian_pkgs
:
[]
splunk-server_debian_pkgs
:
[]
splunk-server_redhat_pkgs
:
[]
splunk-server_redhat_pkgs
:
[]
#S3 bucket to store data rolled from splunk cold bucket
SPLUNK_FROZEN_DB_S3_BUCKET
:
"
{{
SPLUNK_FROZEN_DB_DATA_S3_BUCKET
}}"
playbooks/roles/splunk-server/tasks/main.yml
View file @
532d476c
...
@@ -149,6 +149,17 @@
...
@@ -149,6 +149,17 @@
-
install
-
install
-
install:configuration
-
install:configuration
-
name
:
create splunk coldToFrozen script
template
:
src
:
"
opt/splunk/bin/coldToFrozenS3.j2"
dest
:
"
{{
splunk_home
}}/bin/coldToFrozenS3"
owner
:
"
{{
splunk_user
}}"
group
:
"
{{
splunk_user
}}"
mode
:
0700
tags
:
-
"
install"
-
"
install:configuration"
-
name
:
restart splunk
-
name
:
restart splunk
service
:
service
:
name
:
splunk
name
:
splunk
...
@@ -157,4 +168,3 @@
...
@@ -157,4 +168,3 @@
-
"
install"
-
"
install"
-
"
install:configuration"
-
"
install:configuration"
-
"
restart"
-
"
restart"
playbooks/roles/splunk-server/templates/opt/splunk/bin/coldToFrozenS3.j2
0 → 100644
View file @
532d476c
#!/bin/bash
s3_backup_bucket
=
"{{ SPLUNK_FROZEN_DB_S3_BUCKET }}"
if
[
$#
-lt
1
]
;
then
echo
"Usage: /bin/bash coldToFrozenS3 <bucket_dir_to_archive>"
exit
1
fi
colddb
=
$1
if
[[
$colddb
==
*
/
]]
;
then
colddb
=
${
colddb
::-1
}
fi
if
[[
!
-d
$colddb
]]
;
then
echo
"Given splunk bucket is not a valid directory:
$colddb
"
exit
1
elif
[[
!
-d
$colddb
/rawdata
]]
;
then
echo
"No rawadata directory, this not an index database:
$colddb
"
exit
1
fi
# We have splunk bucket path like this /SPLUNK/DB/PATH/$index/colddb/$splunkbucket
# and want to move on s3 bucket in format as s3://$s3_backup_bucket/$index/frozendb/$splunkbucket
read
-a
segments
<<
EOF
$(
echo
$colddb
| awk
-F
"/"
'{print $(NF-2)" "$(NF)}'
)
EOF
index
=
${
segments
[0]
}
splunkbucket
=
${
segments
[1]
}
remotepath
=
"s3://
${
s3_backup_bucket
}
/
${
index
}
/frozendb/
${
splunkbucket
}
"
# Transfer splunk cold bucket to s3
# We want to timeout s3 upload and kill it if command running after 15 minutes
# as it will occupy splunk worker slots and will effect indexing
timeout
=
900
awscli
=
$(
/usr/bin/timeout
${
timeout
}
/usr/bin/aws s3 sync
${
colddb
}
${
remotepath
})
retval
=
$?
if
[
$retval
-ne
0
]
;
then
echo
"S3 upload failed to rolled data from splunk cold bucket"
2>&1
fi
playbooks/roles/splunk-server/templates/opt/splunk/etc/apps/search/local/indexes.conf.j2
View file @
532d476c
...
@@ -18,8 +18,8 @@ thawedPath = {{ index.thawedPath }}
...
@@ -18,8 +18,8 @@ thawedPath = {{ index.thawedPath }}
{% else %}
{% else %}
thawedPath = {{ splunk_thawed_dir }}/{{ index.name }}/thaweddb
thawedPath = {{ splunk_thawed_dir }}/{{ index.name }}/thaweddb
{% endif %}
{% endif %}
{% if index.coldToFrozen
Dir is not
defined %}
{% if index.coldToFrozen
Script is
defined %}
coldToFrozen
Dir = {{ splunk_frozen_dir }}/{{ index.name }}/frozendb
coldToFrozen
Script = {{ splunk_home }}/bin/coldToFrozenS3
{% endif %}
{% endif %}
{% if index.disabled is defined %}
{% if index.disabled is defined %}
disabled = {{ index.disabled }}
disabled = {{ index.disabled }}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment