Net::Graylog::API - API Client for Net::Graylog::API
version 0.7
use Net::Graylog::API ; my $api = Net::Graylog::API->new( url => 'http://server:12345' ) ; $api->api_command( message => 'testing', 'debug') ;
This module has been autogenerated against a Swagger API, hopefully the author has fixed up the documentation
Currently this module is only using Basic auth over HTTP, not yet got into the complexity of anything else.
Net::Graylog::API
autogenerated by create_swagger_api, Which was created by kevin Mulholland, moodfarm@cpan.org
v0.1
Currently I am unsure if the PUT/POST actions work
Due to issues with Graylog2 documentation, I cannot test that any of the methods that use post/put actions will work, so lets assume for now that they do not
Investigate HTTP::Async instead of :Furl as it will not block, so we can wait for the response to be received, rather than the timeout to lapse
* begin_column [Integer] * begin_line [Integer] * end_column [Integer] * end_line [Integer]
* type [String]
* exception_name [String] * message [String]
* properties [Object] * index [String] * message [Object] * additional_properties [Any]
* additional_properties [String]
* properties [Object] * last_access [String] * name [String] * token [String]
Any method may die, you may need to catch these.
Create a new instance of the api connection
my $api = Net::Graylog::API->new( url => 'http://server:12345') ;
Parameters url the url of the server API, of the form http://server:12345 timeout, can be a float, default 0.01, Furl seems to wait until the timeout occurs before giving a response, which really cuts into the speed of sending, you may want to make this bigger for non-local servers, ie 1s
Manage stream alerts
Get the 100 most recent alarms of this stream.
streamId [String] The stream id this new alert condition belongs to.
Returns: Normal Furl::Response, with decoded JSON in json element
Check for triggered alert conditions of this streams. Results cached for 30 seconds.
streamId [String] The ID of the stream to check.
Get all alert conditions of this stream
Create a alert condition
JSON body [String]
Delete an alert condition
conditionId [String] The stream id this new alert condition belongs to.
Add an alert receiver
entity [String] Name/ID of user or email address to add as alert receiver.
type [String] Type: users or emails
Returns: Normal Furl::Response, possible data in content
Remove an alert receiver
entity [String] Name/ID of user or email address to remove from alert receivers.
Send a test mail for a given stream
Message counts
Total number of messages in all your indices.
Returns: [String] Normal Furl::Response, with decoded JSON in json element
Manage dashboards
Get a list of all dashboards and all configurations of their widgets.
Create a dashboard
Get a single dashboards and all configurations of its widgets.
dashboardId [String]
Delete a dashboard and all its widgets
Update the settings of a dashboard.
Update/set the positions of dashboard widgets.
Add a widget to a dashboard
Delete a widget
widgetId [String]
Update cache time of a widget
Update description of a widget
Get a single widget value.
Documentation of this API in JSON format.
Get API documentation
Get detailed API documentation of a single resource
route [String] Route to fetch. For example /system
Extractors of an input
List all extractors of an input
inputId [String]
Add an extractor to an input
Delete an extractor
extractorId [String]
Indexer cluster information
Get cluster and shard health overview
Get the cluster name
Indexer failures
Get a list of failed index operations.
limit [Integer] Limit
offset [Integer] Offset
Total count of failed index operations since the given date.
since [String] ISO8601 date
Index informations
Get a list of closed indices that can be reopened.
Get information of an index and its shards.
index [String]
Delete an index. This will also trigger an index ranges rebuild job.
Close an index. This will also trigger an index ranges rebuild job.
Reopen a closed index. This will also trigger an index ranges rebuild job.
Single messages
Analyze a message string
Note: Returns what tokens/terms a message string (message or full_message) is split to.
index [String] The index the message containing the string is stored in.
string [String] The string to analyze.
Get a single message.
index [String] The index this message is stored in.
messageId [String]
Message search
Message search with absolute timerange.
Note: Search for messages using an absolute timerange, specified as from/to with format yyyy-MM-ddTHH:mm:ss.SSSZ (e.g. 2014-01-23T15:34:49.000Z) or yyyy-MM-dd HH-mm-ss.
query [String] Query (Lucene syntax)
from [String] Timerange start. See description for date format
to [String] Timerange end. See description for date format
limit [Integer] Maximum number of messages to return.
filter [String] Filter
sort [String] Sorting (field:asc / field:desc)
Returns: ["SearchResponse"] Normal Furl::Response, with decoded JSON in json element
Field value histogram of a query using an absolute timerange.
field [String] Field of whose values to get the histogram of
interval [String] Histogram interval / bucket size. (year, quarter, month, week, day, hour or minute)
from [String] Timerange start. See search method description for date format
to [String] Timerange end. See search method description for date format
Datetime histogram of a query using an absolute timerange.
Field statistics for a query using an absolute timerange.
Note: Returns statistics like min/max or standard deviation of numeric fields over the whole query result set.
field [String] Message field of numeric type to return statistics for
Most common field terms of a query using an absolute timerange.
field [String] Message field of to return terms of
size [Integer] Maximum number of terms to return
Message search with keyword as timerange.
Note: Search for messages in a timerange defined by a keyword like "yesterday" or "2 weeks ago to wednesday".
keyword [String] Range keyword
Datetime histogram of a query using keyword timerange.
Field statistics for a query using a keyword timerange.
Most common field terms of a query using a keyword timerange.
Message search with relative timerange.
Note: Search for messages in a relative timerange, specified as seconds from now. Example: 300 means search from 5 minutes ago to now.
range [Integer] Relative timeframe to search in. See method description.
Field value histogram of a query using a relative timerange.
range [Integer] Relative timeframe to search in. See search method description.
Datetime histogram of a query using a relative timerange.
Field statistics for a query using a relative timerange.
Most common field terms of a query using a relative timerange.
Saved searches
Get a list of all saved searches
Create a new saved search
Get a single saved search
searchId [String]
Returns: [String] Normal Furl::Response, possible data in content
Delete a saved search
Listing message sources (e.g. hosts sending logs)
Get a list of all sources (not more than 5000) that have messages in the current indices. The result is cached for 10 seconds.
Note: Range: The parameter is in seconds relative to the current time. 86400 means 'in the last day',0 is special and means 'across all indices'
Static fields of an input
Add a static field to an input
Remove static field of an input
Key [String]
Manage stream rules
Get a list of all stream rules
streamid [String] The id of the stream whose stream rules we want.
Create a stream rule
streamid [String] The stream id this new rule belongs to.
Get a single stream rules
streamid [String] The id of the stream whose stream rule we want.
streamRuleId [String] The stream rule id we are getting
Delete a stream rule
streamRuleId [String]
Update a stream rule
streamid [String] The stream id this rule belongs to.
streamRuleId [String] The stream rule id we are updating
Manage streams
Get a list of all streams
Create a stream
Current throughput of all visible streams on this node in messages per second
Get a single stream
streamId [String]
Delete a stream
Update a stream
Clone a stream
Pause a stream
Resume a stream
Test matching of a stream against a supplied message
Current throughput of this stream on this node in messages per second
System information of this node.
Get system overview
Get list of message fields that exist
Note: This operation is comparably fast because it reads directly from the indexer mapping.
limit [Integer] Maximum number of fields to return. Set to 0 for all fields.
Get JVM information
Get all available user permissions.
Get the initial permissions assigned to a reader account
username [String]
Returns: ["ReaderPermissionResponse"] Normal Furl::Response, with decoded JSON in json element
Pauses message processing
Note: Inputs that are able to reject or requeue messages will do so, others will buffer messages in memory. Keep an eye on the heap space utilization while message processing is paused.
Resume message processing
Get a thread dump
Returns: [String] Normal Furl::Response, possible plain text response in content
Buffer information of this node.
Get current utilization of buffers and caches of this node.
Node discovery
Information about this node.
Note: This is returning information of this node in context to its state in the cluster. Use the system API of the node itself to get system information.
List all active nodes in this cluster.
Information about a node.
Note: This is returning information of a node in context to its state in the cluster. Use the system API of the node itself to get system information.
nodeId [String]
Index deflector management
Get current deflector status
Get deflector configuration. Only available on master nodes.
Cycle deflector to new/next index
Index timeranges
Get a list of all index ranges
Rebuild/sync index range information.
Note: This triggers a systemjob that scans every index and stores meta information about what indices contain messages in what timeranges. It atomically overwrites already existing meta information.
Message inputs of this node
Get all inputs of this node
Launch input on this node
Get all available input types of this node
Get information about a single input type
inputType [String]
Get information of a single input on this node
Terminate input on this node
Launch existing input on this node
Systemjobs
Trigger new job
List currently running jobs
Get information of a specific currently running job
jobId [String]
LDAP settings
Get the LDAP configuration if it is configured
Update the LDAP configuration
Remove the LDAP configuration
Test LDAP Configuration
Configuration to test [LdapTestConfigRequest]
Returns: ["LdapTestConfigResponse"] Normal Furl::Response, with decoded JSON in json element
Internal Graylog2 loggers
List all loggers and their current levels
List all logger subsystems and their current levels
Set the loglevel of a whole subsystem
Note: Provided level is falling back to DEBUG if it does not exist
subsystem [String]
level [String]
Set the loglevel of a single logger
loggerName [String]
Internal Graylog2 messages
Get internal Graylog2 system messages
page [Integer] Page
Internal Graylog2 metrics
Get all metrics
Note: Note that this might return a huge result set.
Get all metrics keys/names
Get all metrics of a namespace
namespace [String]
Get a single metric
metricName [String]
Get history of a single metric
Note: The maximum retention time is currently only 5 minutes.
after [Long] Only values for after this UTC timestamp (1970 epoch)
Notifications generated by the system
Get all active notifications
Delete a notification
notificationType [String]
Management of graylog2-radio nodes.
List all active radios in this cluster.
Information about a radio.
Note: This is returning information of a radio in context to its state in the cluster. Use the system API of the node itself to get system information.
radioId [String]
Register input of a radio.
Note: Radio inputs register their own inputs here for persistence after they successfully launched it.
Persisted inputs of a radio.
Note: This is returning the configured persisted inputs of a radio node. This is *not* returning the actually running inputs on a radio node. Radio nodes use this resource to get their configured inputs on startup.
Unregister input of a radio.
Note: Radios unregister their inputs when they are stopped/terminated on the radio.
Ping - Accepts pings of graylog2-radio nodes.
Note: Every graylog2-radio node is regularly pinging to announce that it is active.
Login for interactive user sessions
Create a new session
Note: This request creates a new session for a user or reactivates an existing session: the equivalent of logging in.
Login request [SessionCreateRequest] Username and credentials
Returns: [Session] Normal Furl::Response, possible data in content
Terminate an existing session
Note: Destroys the session with the given ID: the equivalent of logging out.
sessionId [String]
Message throughput of this node
Current throughput of this node in messages per second
User accounts
List all users
Note: The permissions assigned to the users are always included.
Create a new user account.
Modify user details.
username [String] The name of the user to modify.
Removes a user account.
username [String] The name of the user to delete.
Get user details
Note: The user's permissions are only included if a user asks for his own account or for users with the necessary permissions to edit permissions.
username [String] The username to return information for.
Update the password for a user.
username [String] The name of the user whose password to change.
JSON body [String] The hashed old and new passwords.
Update a user's permission set.
JSON body [String] The list of permissions to assign to the user.
Revoke all permissions for a user without deleting the account.
Retrieves the list of access tokens for a user
Returns: ["TokenList"] Normal Furl::Response, with decoded JSON in json element
Generates a new access token for a user
name [String] Descriptive name for this token (e.g. 'cronjob')
Returns: [Token] Normal Furl::Response, with decoded JSON in json element
Removes a token for a user
access token [String]
Kevin Mulholland <moodfarm@cpan.org>
This software is copyright (c) 2014 by Kevin Mulholland.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Kevin Mulholland <moodfarm@cpan.org> James Lavoy <jalavoy@cpan.org>
This software is copyright (c) 2017 by Kevin Mulholland.
To install Net::Graylog::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Graylog::Client
CPAN shell
perl -MCPAN -e shell install Net::Graylog::Client
For more information on module installation, please visit the detailed CPAN module installation guide.