Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Kulya
OpnSense
Commits
1a9e8c96
Commit
1a9e8c96
authored
Nov 13, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(configd) send configd client issues to syslog, closes
https://github.com/opnsense/core/issues/464
parent
3026a561
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
Backend.php
src/opnsense/mvc/app/library/OPNsense/Core/Backend.php
+23
-3
No files found.
src/opnsense/mvc/app/library/OPNsense/Core/Backend.php
View file @
1a9e8c96
...
...
@@ -29,6 +29,8 @@
*/
namespace
OPNsense\Core
;
use
Phalcon\Logger\Adapter\Syslog
;
/**
* Class Backend
* @package OPNsense\Core
...
...
@@ -48,6 +50,21 @@ class Backend
{
}
/**
* get system logger
* @param string $ident syslog identifier
* @return Syslog log handler
*/
protected
function
getLogger
(
$ident
=
"configd"
)
{
$logger
=
new
Syslog
(
$ident
,
array
(
'option'
=>
LOG_PID
,
'facility'
=>
LOG_LOCAL4
));
return
$logger
;
}
/**
* send event to backend
* @param string $event event string
...
...
@@ -67,14 +84,16 @@ class Backend
sleep
(
1
);
$timeout_wait
-=
1
;
if
(
$timeout_wait
<=
0
)
{
throw
new
\Exception
(
"failed waiting for configd (doesn't seem to be running)"
);
$this
->
getLogger
()
->
error
(
"failed waiting for configd (doesn't seem to be running)"
);
return
null
;
}
}
$resp
=
""
;
$stream
=
stream_socket_client
(
'unix://'
.
$this
->
configdSocket
,
$errorNumber
,
$errorMessage
,
$poll_timeout
);
if
(
$stream
===
false
)
{
throw
new
\Exception
(
"Failed to connect:
$errorMessage
"
);
$this
->
getLogger
()
->
error
(
"Failed to connect:
$errorMessage
"
);
return
null
;
}
stream_set_timeout
(
$stream
,
$poll_timeout
);
...
...
@@ -97,7 +116,8 @@ class Backend
// handle timeouts
if
((
time
()
-
$starttime
)
>
$timeout
)
{
throw
new
\Exception
(
"Timeout ("
.
$timeout
.
") executing :"
.
$event
);
$this
->
getLogger
()
->
error
(
"Failed to connect:
$errorMessage
"
);
return
null
;
}
}
...
...
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