技术问询:Fluentd-ui能否接收FIWARE Orion推送至MongoDB的数据?
Hey there! I know diving into new tools like Fluentd can feel a bit daunting at first, but let’s walk through getting Fluentd to pull data straight from your Orion Context Broker step by step. The core idea here is leveraging Orion’s built-in subscription system to push context updates directly to Fluentd, cutting out the MongoDB middleman entirely.
1. First: Understand Orion’s Notification Mechanism
Orion lets you create subscriptions that trigger HTTP POST requests to a specified endpoint whenever context data changes (like when an entity is created, updated, or deleted). This is exactly how we’ll route data directly to Fluentd—we’ll set up a subscription that sends updates straight to Fluentd’s HTTP input.
2. Configure Fluentd to Accept HTTP Input from Orion
Since you’re using Fluentd-UI, we’ll handle this through the web interface:
- Open your browser and navigate to
http://your-server-ip:9292(the mapped Fluentd-UI port) - Log in with your credentials (default is often
admin/adminif you haven’t modified it) - Go to Inputs → Add Input
- Select the
httpplugin from the available options - Configure the input with these settings:
- Port: Pick a port (e.g.,
9880—make sure this port is mapped in your Fluentd Docker run command, add-p 9880:9880if it’s missing) - Tag: Assign a meaningful tag like
orion.context.updates(this helps filter and organize data later in Fluentd)
- Port: Pick a port (e.g.,
- Save the configuration—Fluentd will restart to apply the changes
3. Create a Subscription in Orion to Push Data to Fluentd
Now we need to tell Orion where to send its context updates. Run this curl command from your server (or any machine that can reach Orion’s 1026 port):
curl -i -X POST \ http://your-server-ip:1026/v2/subscriptions \ -H "Content-Type: application/json" \ -d '{ "description": "Forward context updates to Fluentd", "subject": { "entities": [ { "idPattern": ".*" # Matches all entities—adjust if you want to target specific ones } ], "condition": { "attrs": [] # Triggers on any attribute change; specify attrs here if you want filtered updates } }, "notification": { "http": { "url": "http://fluentd-container-name:9880/orion" # Use Fluentd container name if in the same Docker network, or your server IP + mapped port like "http://192.168.1.100:9880/orion" }, "attrs": [] Sends all attributes—list specific ones if you don’t need everything }, "expires": "2030-01-01T00:00:00Z" # Sets a far-future expiration so the subscription stays active }'
Quick URL Notes:
- If all your containers are in the same Docker network (highly recommended!), use the Fluentd container’s name instead of the server IP (e.g.,
http://fluentd-ui:9880/orionif your container is namedfluentd-ui). - If they’re on separate networks, use your server’s public/private IP plus the mapped port.
4. Verify Data is Reaching Fluentd
To confirm everything works as expected:
- Trigger a context update in Orion (e.g., create or update an entity using your existing workflow or a simple curl command)
- Head back to Fluentd-UI’s Dashboard—you should see incoming data tagged with
orion.context.updates - For extra validation, add a file output in Fluentd-UI:
- Go to Outputs → Add Output
- Select the
fileplugin - Set the Path to
/var/log/orion-data.log(ensure Fluentd has write access to this path) - Match the Tag to
orion.context.updates - Save the output, then check the log file (either on your server or inside the Fluentd container) to see the incoming Orion data
Troubleshooting Tips
If data isn’t showing up in Fluentd:
- Double-check that the Fluentd HTTP port is correctly mapped in Docker and accessible from Orion
- Verify the subscription was created by running
curl http://your-server-ip:1026/v2/subscriptions—your subscription should appear in the list - Check Orion’s logs with
docker logs <orion-container-name>for errors sending notifications - Check Fluentd’s logs with
docker logs <fluentd-container-name>for input-related issues
That’s all! You should now have Fluentd receiving data directly from Orion, ready for whatever processing you need to do next.
内容的提问来源于stack exchange,提问作者TheHeroOfTime

