Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
Read_from_Kairos_Component
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dasharatha.vamshi
Read_from_Kairos_Component
Commits
4a98adec
Commit
4a98adec
authored
Feb 23, 2021
by
Akshay G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Logstash logger
parent
f78499fc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
9 deletions
+17
-9
Dockerfile
Dockerfile
+3
-2
Dockerfile_bkp
Dockerfile_bkp
+0
-5
conf/configuration.yml
conf/configuration.yml
+2
-0
requirements.txt
requirements.txt
+2
-1
scripts/common/config_parser.py
scripts/common/config_parser.py
+4
-0
scripts/common/logsetup.py
scripts/common/logsetup.py
+6
-1
No files found.
Dockerfile
View file @
4a98adec
FROM
azacrknowledgelens.azurecr.io/ai-forecasting/batch-multi-karios-read-component:v0.6
FROM
python:3.7-slim
ADD
. /opt
ADD
. /opt
WORKDIR
/opt
WORKDIR
/opt
RUN
pip
install
-r
requirements.txt
CMD
python main.py
CMD
python main.py
\ No newline at end of file
Dockerfile_bkp
deleted
100755 → 0
View file @
f78499fc
FROM
python:3.7-slim
ADD
. /opt
WORKDIR
/opt
RUN
pip
install
-r
requirements.txt
CMD
python main.py
\ No newline at end of file
conf/configuration.yml
View file @
4a98adec
...
@@ -2,3 +2,5 @@
...
@@ -2,3 +2,5 @@
SERVICE_CONFIG
:
SERVICE_CONFIG
:
LOG_LEVEL
:
info
LOG_LEVEL
:
info
LOG_HANDLER_NAME
:
ReadFromKairos
LOG_HANDLER_NAME
:
ReadFromKairos
LOGSTASH_HOST
:
192.168.1.47
LOGSTASH_PORT
:
5000
requirements.txt
View file @
4a98adec
requests
requests
pandas
pandas
pyyaml
pyyaml
python-logstash-async
\ No newline at end of file
scripts/common/config_parser.py
View file @
4a98adec
...
@@ -47,6 +47,10 @@ if not os.path.exists(os.path.join(os.getcwd(), 'logs')):
...
@@ -47,6 +47,10 @@ if not os.path.exists(os.path.join(os.getcwd(), 'logs')):
LOG_LEVEL
=
os
.
environ
.
get
(
"LOG_LEVEL"
,
_config
.
get
(
'SERVICE_CONFIG'
,
{})
.
get
(
"LOG_LEVEL"
,
"INFO"
))
.
upper
()
LOG_LEVEL
=
os
.
environ
.
get
(
"LOG_LEVEL"
,
_config
.
get
(
'SERVICE_CONFIG'
,
{})
.
get
(
"LOG_LEVEL"
,
"INFO"
))
.
upper
()
LOG_HANDLER_NAME
=
_config
.
get
(
'SERVICE_CONFIG'
,
{})
.
get
(
"LOG_HANDLER_NAME"
,
"ReadFromKairos"
)
LOG_HANDLER_NAME
=
_config
.
get
(
'SERVICE_CONFIG'
,
{})
.
get
(
"LOG_HANDLER_NAME"
,
"ReadFromKairos"
)
ENABLE_LOGSTASH_LOG
=
os
.
environ
.
get
(
"ENABLE_LOGSTASH_LOG"
,
'False'
)
.
lower
()
LOGSTASH_HOST
=
os
.
environ
.
get
(
"LOGSTASH_HOST"
,
_config
.
get
(
'SERVICE_CONFIG'
,
{})
.
get
(
'LOGSTASH_HOST'
))
LOGSTASH_PORT
=
str
(
os
.
environ
.
get
(
"LOGSTASH_PORT"
,
_config
.
get
(
'SERVICE_CONFIG'
,
{})
.
get
(
'LOGSTASH_PORT'
)))
config
=
{
config
=
{
"shared_volume"
:
os
.
environ
.
get
(
"shared_volume"
),
"shared_volume"
:
os
.
environ
.
get
(
"shared_volume"
),
...
...
scripts/common/logsetup.py
View file @
4a98adec
import
os
import
os
import
logging
import
logging
from
logging.handlers
import
RotatingFileHandler
from
logging.handlers
import
RotatingFileHandler
from
logstash_async.handler
import
AsynchronousLogstashHandler
from
scripts.common.config_parser
import
LOG_LEVEL
,
LOG_HANDLER_NAME
,
BASE_LOG_PATH
,
LOGSTASH_HOST
,
LOGSTASH_PORT
,
\
ENABLE_LOGSTASH_LOG
from
scripts.common.config_parser
import
LOG_LEVEL
,
LOG_HANDLER_NAME
,
BASE_LOG_PATH
DEFAULT_FORMAT
=
'
%(asctime)
s
%(levelname)5
s
%(name)
s
%(message)
s'
DEFAULT_FORMAT
=
'
%(asctime)
s
%(levelname)5
s
%(name)
s
%(message)
s'
DEBUG_FORMAT
=
'
%(asctime)
s
%(levelname)5
s
%(name)
s [
%(threadName)5
s:
%(filename)5
s:
%(funcName)5
s():
%(lineno)
s]
%
('
\
DEBUG_FORMAT
=
'
%(asctime)
s
%(levelname)5
s
%(name)
s [
%(threadName)5
s:
%(filename)5
s:
%(funcName)5
s():
%(lineno)
s]
%
('
\
...
@@ -43,6 +46,8 @@ def get_logger(log_handler_name):
...
@@ -43,6 +46,8 @@ def get_logger(log_handler_name):
handler
.
setFormatter
(
formatter
)
handler
.
setFormatter
(
formatter
)
_logger
.
addHandler
(
log_handler
)
_logger
.
addHandler
(
log_handler
)
_logger
.
addHandler
(
handler
)
_logger
.
addHandler
(
handler
)
if
ENABLE_LOGSTASH_LOG
==
'true'
and
LOGSTASH_PORT
is
not
None
and
LOGSTASH_HOST
is
not
None
and
LOGSTASH_PORT
.
isdigit
():
_logger
.
addHandler
(
AsynchronousLogstashHandler
(
LOGSTASH_HOST
,
int
(
LOGSTASH_PORT
),
database_path
=
None
))
return
_logger
return
_logger
...
...
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