https://github.com/extrawurst/syslogservice
webservice that gathers arbitrary requests in syslog format on disk (we use this primarily to feed splunk)
https://github.com/extrawurst/syslogservice
Last synced: 5 months ago
JSON representation
webservice that gathers arbitrary requests in syslog format on disk (we use this primarily to feed splunk)
- Host: GitHub
- URL: https://github.com/extrawurst/syslogservice
- Owner: extrawurst
- License: mit
- Created: 2014-03-05T13:16:18.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-01-05T11:32:02.000Z (over 9 years ago)
- Last Synced: 2025-01-25T17:44:08.046Z (over 1 year ago)
- Language: D
- Size: 25.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
syslogservice [](https://travis-ci.org/Extrawurst/syslogservice) [](https://code.dlang.org/packages/syslogservice) [](https://code.dlang.org/packages/syslogservice)
=============
This is a webservice that gathers arbitrary requests in syslog format on disk (we use this primarily to feed splunk)
usage as application
=============
this is a dub compatible package.
run it with default settings like this:
```
dub --config="application"
```
which prints:
```
Running .\syslogservice.exe
Listening for HTTP requests on 0.0.0.0:8888
hostname: hostUnknown
quiet: true
logfolder: './'
logfilesuffix: ''
logFilesSplitByHour: false
```
now the service listens on port 8888 for stuff to write to log.
test it using curl:
```
curl --data "param1=value1¶m2=value2" http://localhost:8888/event
curl --data "param1=value1¶m2=value2" http://localhost:8888/foo/bar
```
which leads to a log line like this:
```
Mar 05 15:30:40 hostUnknown - event [param1="value1" param2="value2" ]
Mar 05 15:30:40 hostUnknown foo - bar [param1="value1" param2="value2" ]
```
cmd line
-------------
```
--folder= log folder (default './'
--hostport= port (default '8888')
--hostname= hostname (default 'hostUnknown'
--quiet disable logging of each request to stdout (default 'true')
--filePerHour split log files per hour (default is split per day)
--file-suffix= added to every log filename (default is '')
```
usage as lib
=============
add the dependancy:
```
{
...
"dependencies": {
"syslogservice": "~master"
}
}
```
server
-------------
to host a syslogservice simply use this:
```
import syslog.service;
shared static this()
{
auto logger = new SysLogService();
logger.port = 8888;
logger.start();
}
```
client
-------------
more importantly this is how you can write to such a service from you code:
```
import syslog.serviceclient;
SyslogServiceClient logger = new SyslogServiceClient("http://localhost:8888/");
logger.log!"event1"();
logger.log!"event2"(["param2":"value"]);
// or using the auto converter template:
logger.log!"event3"(
"param2","someString",
"param3",42,
"param4",true);
```