Compare commits

...

9 Commits

Author SHA1 Message Date
Ronny Grobel
7c5ad6abbe
Create LICENSE 2024-08-26 23:28:22 +02:00
Ronny Grobel
748f0c5157
Update table.sql
add Create Sequence
2022-06-09 08:40:54 +02:00
Ronny Grobel
cc9035cf4e
Create dependabot.yml 2020-11-28 22:16:24 +01:00
Ronny Grobel
d44c2c1d1d
Create dependabot.yml 2020-11-28 22:11:57 +01:00
Ronny Grobel
82b04af0c8
Update requirements.txt 2020-11-28 22:08:53 +01:00
Ronny Grobel
4305529bf7
Update README.md 2020-11-27 23:05:18 +01:00
Ronny Grobel
8a3fc9ef6c
Multi-threaded 2020-11-27 23:04:59 +01:00
Ronny Grobel
41015bdbcd
Update SysLogServer.py 2020-11-27 22:27:35 +01:00
Ronny Grobel
5a827f4173 Update issue templates 2020-11-26 22:59:56 +01:00
8 changed files with 100 additions and 35 deletions

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

11
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gitsubmodule" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -5,4 +5,3 @@ required libraries
https://github.com/oracle/python-cx_Oracle.git
https://github.com/pyparsing/pyparsing.git

View File

@ -8,60 +8,53 @@ HOST, PORT = "0.0.0.0", 514
OracleUser = ''
OraclePasswd = ''
OracleServerSid = "localhost/orclpdb1"
#
# NO USER SERVICEABLE PARTS BELOW HERE...
#
import sys
from pyparsing import Word, alphas, Suppress, Combine, nums, string, Optional, Regex
from time import strftime
import cx_Oracle
import config
import logging
import SocketServer
import socketserver
import json
import threading
connection = cx_Oracle.connect(OracleUser, OraclePasswd, OracleServerSid)
connection = cx_Oracle.connect(OracleUser, OraclePasswd, OracleServerSid, threaded = True)
cursor = connection.cursor()
def insert_logging(IP,PRIO,STAMP,HOST,APP,PID,MESS):
"""
Insert a row to the SYSLOG table
:param IP:
"""
Insert a row to the SYSLOG table
:param IP:
:param APP:
:param STAMP:
:param HOST:
:param PID:
:param STAMP:
:param HOST:
:param PID:
:param PRIO:
:param MESS:
:return:
"""
sql = ('insert into SYSLOG(REMOTEIP,APPNAME,ZEIT,HOSTNAME,PID,PRIORITY,MESSAGE) '
'values(:IP,:APP,:STAMP,:HOST,:PID,:PRIO,:MESS)')
try:
cursor.execute(sql, [IP, APP, STAMP, HOST, PRIO, PID, MESS])
connection.commit()
except cx_Oracle.Error as error:
print('Error occurred:')
print(error)
:param MESS:
:return:
"""
# construct an insert statement that add a new row to the billing_headers table
sql = ('insert into SYSLOG(REMOTEIP,APPNAME,ZEIT,HOSTNAME,PID,PRIORITY,MESSAGE) values (:IP,:APP,:STAMP,:HOST,:PID,:PRIO,:MESS)')
try:
cursor.execute(sql, [IP, APP, STAMP, HOST, PRIO, PID, MESS])
connection.commit()
except cx_Oracle.Error as error:
print('Error occurred:')
print(error)
class SyslogUDPHandler(SocketServer.BaseRequestHandler):
class SyslogUDPHandler(socketserver.BaseRequestHandler):
def handle(self):
data = bytes.decode(self.request[0].strip())
socket = self.request[1]
print( "%s : " % self.client_address[0], str(data))
fields = json.loads(str(data))
insert_logging("%s" % self.client_address[0],fields["PRIO"].strip(),fields["TIME"],fields["HOST"],fields["APP"],fields["PID"].strip(),fields["MSG"])
print("Recieved one request from {}".format(self.client_address[0]))
print("Thread Name:{}".format(threading.current_thread().name))
if __name__ == "__main__":
try:
server = SocketServer.UDPServer((HOST,PORT), SyslogUDPHandler)
server.serve_forever(poll_interval=0.5)
server = socketserver.ThreadingUDPServer((HOST,PORT), SyslogUDPHandler)
server.serve_forever()
except (IOError, SystemExit):
raise
except KeyboardInterrupt:

20
dependabot.yml Normal file
View File

@ -0,0 +1,20 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gitsubmodule" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

View File

@ -1,2 +1 @@
git+https://github.com/pyparsing/pyparsing.git#egg=pyparsing
git+https://github.com/oracle/python-cx_Oracle.git#egg=cx_Oracle

View File

@ -14,6 +14,8 @@ CREATE TABLE "SYSLOG"
) NO INMEMORY
/
CREATE SEQUENCE "SYSLOG_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 241 CACHE 20 NOORDER NOCYCLE NOKEEP NOSCALE GLOBAL
/
CREATE OR REPLACE EDITIONABLE TRIGGER "BI_SYSLOG"
before insert on "SYSLOG"