1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Michael Herold <quabla@hemio.de>
Date: Fri, 10 Jun 2016 00:44:52 +0200
Subject: [PATCH] Updates build instructions and example
---
README.md | 58 +++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 43 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index cd80bef..a37d640 100644
--- a/README.md
+++ b/README.md
@@ -1,40 +1,68 @@
php-systemd
-============
+===========
PHP extension allowing native interaction with systemd and journald
Installation
-============
+------------
+
+### Prerequisites
+
+.deb based
- sudo dnf install php-devel systemd-devel
sudo apt install php5-dev libsystemd-dev
+.rpm based
+
+ sudo dnf install php-devel systemd-devel
+
+### Build
+
phpize
./configure --with-systemd
make
+
+### Setup
+
sudo make install
+
+Fedora
+
echo "extension=systemd.so" | sudo tee /etc/php.d/systemd.ini
+
+Debian (PHP 5)
+
+ echo "extension=systemd.so" | sudo tee /etc/php5/mods-available/systemd.ini
+ sudo php5enmod systemd
+
+### Basic Test
+
echo "<?php echo sd_journal_send('MESSAGE=hello world');" | php
-
+
Usage
-=====
+-----
Quick example:
- <?php
- sd_journal_send('MESSAGE=Hello world.');
- sd_journal_send('MESSAGE=Hello, again, world.', 'FIELD2=Greetings!', 'FIELD3=Guten tag.');
- sd_journal_send('ARBITRARY=anything', 'FIELD3=Greetings!');
+``` {.php}
+<?php
+sd_journal_send('MESSAGE=Hello world.');
+sd_journal_send('MESSAGE=Hello, again, world.', 'FIELD2=Greetings!', 'FIELD3=Guten tag.');
+sd_journal_send('ARBITRARY=anything', 'FIELD3=Greetings!');
+```
Notes:
- * Each argument must be in the form of a KEY=value pair, environmental variable style.
- * Unlike the native C version of journald's sd_journal_send(), printf-style substitution is not supported. Perform any substitution using PHP's sprintf() or similar capabilities first.
- * The base message is usually sent in the form MESSAGE=hello. The MESSAGE field is, however, not required.
- * Invalid arguments result in nothing recorded in the journal.
+- Each argument must be in the form of a KEY=value pair, environmental
+ variable style.
+- Unlike the native C version of journald's `sd_journal_send()`,
+ printf-style substitution is not supported. Perform any substitution
+ using PHP's `sprintf()` or similar capabilities first.
+- The base message is usually sent in the form MESSAGE=hello. The
+ MESSAGE field is, however, not required.
+- Invalid arguments result in nothing recorded in the journal.
-Viewing Output
-==============
+### Viewing Output
Quick way to view output with all fields as it comes in:
|